Skip to content

Instantly share code, notes, and snippets.

View ErikOG's full-sized avatar

Erik Sundlöf ErikOG

View GitHub Profile
@ErikOG
ErikOG / SingletonMonoBehaviour.cs
Created August 8, 2018 01:11
Most singletons out there will 'destroy' other instances, I think there shouldn't be more than one instance of it to begin with, if there are we just want to find out about it so we can fix the core of the problem and not just the symptom.
using UnityEngine;
#if UNITY_EDITOR || DEBUG
using System;
using UnityEngine.SceneManagement;
#endif
public class SingletonMonoBehaviour<T> : MonoBehaviour where T : MonoBehaviour {
private static T _instance = null;
public static T Instance {
@ErikOG
ErikOG / TMP_InputFieldCustom.cs
Created August 8, 2018 02:12
This is a quick fix to make TMP_InputField not dependant on the IMGUI Package. Has some flaws that need sorting; look at the methods "KeyPressed", "handleKey" and "OnUpdateSelected".
//#define TMP_DEBUG_MODE
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;