private void Awake() {
   if (instance && instance != this) {
     DestroyImmediate(gameObject);
     return;
   } else {
     instance = this;
     DontDestroyOnLoad(gameObject);
   }
 }
示例#2
0
 private void Awake()
 {
     if (instance && instance != this)
     {
         DestroyImmediate(gameObject);
         return;
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }