/* Unity */ private void Awake() { if (instance != null) { GameObject.Destroy(gameObject); return; } instance = this; gameObject.name = gameObjectName; GameObject.DontDestroyOnLoad(gameObject); }
public static void Create() { if (instance != null) { return; } instance = GameObject.FindObjectOfType <StoreEvents>(); if (!instance) { GameObject gameObject = GameObject.Find(gameObjectName); if (!gameObject) { gameObject = new GameObject(gameObjectName); } instance = gameObject.GetComponent <StoreEvents>(); if (!instance) { instance = gameObject.AddComponent <StoreEvents>(); } } }