Пример #1
0
 void Awake()
 {
     if (instance != null) {
         Debug.Log ("Wrong");
         Destroy (gameObject);
         return;
     }
     instance = this;
 }
Пример #2
0
 public static WarpHoleBehavior GetInstance()
 {
     if (instance == null) {
         GameObject go = new GameObject("WarpHoleBehavior");
         go.AddComponent<WarpHoleBehavior>();
         instance = go.GetComponent<WarpHoleBehavior>();
     }
     return instance;
 }