Skip to content

Instantly share code, notes, and snippets.

@Lauwisme
Lauwisme / SingletonScriptableObject.cs
Created November 8, 2021 15:07 — forked from dvddarias/SingletonScriptableObject.cs
Better Unity Singleton Class
/************************************************************
* Better Singleton by David Darias
* Use as you like - credit where due would be appreciated :D
* Licence: WTFPL V2, Dec 2014
* Tested on Unity v5.6.0 (should work on earlier versions)
* 03/02/2017 - v1.1
* **********************************************************/
using System;
using UnityEngine;
@Lauwisme
Lauwisme / gist:0ed27ac1559adb5e821919d4c674596b
Created May 28, 2020 20:10
Regex serializefield private default value
https://answers.unity.com/questions/60461/warning-cs0649-field-is-never-assigned-to-and-will.html
Answer by Delacrowa · Mar 30, 2019 at 03:34 PM
Just in case you don't want to mess up with pragmas, ruin incapsulation and Unity best practices, and/or kill ALL "Field [Name] is never assigned to, and will always have it's default value null" as there can be many useful, then I have one solution. It is best for me now as it covers also store assets. You should replace all
[SerializeField] private GameObject _value;
with
[SerializeField] private GameObject _value = default;
@Lauwisme
Lauwisme / gist:eec91d0960f44dca99d9121fb0623a61
Created March 2, 2020 15:01
## Unity | Android Debugging
## Unity | Android Debugging
There are several ways to debug on the device, which all are not the nicest
(slow, cumbersome).
1. Ensure `adb` is available in the command line. `adb` can found in *<android-sdk>/platform-tools*
where *<android-sdk>* is the path to your android sdk installation; default is
2. Run `adb kill-server` to ensure no devices are connected anymore
3. Connect you device to USB and run `adb usb` to connect over USB
4. Run `adb tcpip 5555` to connect over wifi
5. Run `adb shell ip addr show wlan0` or `adb shell ip route` to get the wifi ip address