상속: MonoBehaviour
예제 #1
0
 void Awake()
 {
     if (instance != null && instance != this) {
         Destroy(this.gameObject);
         return;
     } else {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
 // Use this for initialization
 void Start()
 {
     if (singleton != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         singleton = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }