void Awake() { if (instance != null && instance != this) { Destroy(this); return; } instance = this; DontDestroyOnLoad(gameObject); }
public static KeyCodeCheats GetInstance() { if (instance == null) { instance = (KeyCodeCheats)GameObject.FindObjectOfType <KeyCodeCheats>(); if (instance == null) { GameObject g = new GameObject("KeyCodeCheats"); instance = g.AddComponent <KeyCodeCheats>(); } } return(instance); }