コード例 #1
0
 private void OnDestroy()
 {
     if (Instance == this)
     {
         Instance = null;
     }
 }
コード例 #2
0
 private void Awake()
 {
     if (Instance != null)
     {
         Debug.LogError("Only one instance of singleton allowed");
     }
     Instance = this;
 }