Beispiel #1
0
 private void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
Beispiel #2
0
 private void Awake()
 {
     // 同一种InputDetector只能同时存在一个
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }