public static void Destroy() { if (!exists) { return; } MonoBehaviour.DestroyImmediate(singleton); singleton = null; }
static void CreateIfNeeded() { if (exists) { return; } singleton = new GameObject("Game State Pipe <" + typeof(T).ToString() + ">").AddComponent <GameStatePipeObject>(); MonoBehaviour.DontDestroyOnLoad(singleton.gameObject); }