コード例 #1
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     if (instance != this)
     {
         Destroy(gameObject);
     }
 }
コード例 #2
0
ファイル: KeepOnLoad.cs プロジェクト: jvdwijk/NewAtlantis
 void Awake()
 {
     if (thisScript == null)
     {
         DontDestroyOnLoad(gameObject);
         thisScript = this;
     }
     else if (thisScript != this)
     {
         Destroy(gameObject);
     }
 }
コード例 #3
0
 void Awake()
 {
     if (!kol)
     {
         DontDestroyOnLoad(gameObject);
         kol = this;
     }
     else if (kol != this)
     {
         Destroy(gameObject);
     }
 }