Beispiel #1
0
 /* Unity */
 private void Awake()
 {
     if (instance != null)
     {
         GameObject.Destroy(gameObject);
         return;
     }
     instance        = this;
     gameObject.name = gameObjectName;
     GameObject.DontDestroyOnLoad(gameObject);
 }
Beispiel #2
0
 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>();
         }
     }
 }