示例#1
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
         music.Play();
         DontDestroyOnLoad(gameObject);
     }
     else
         Destroy(gameObject);
 }
示例#2
0
 void Awake()
 {
     if (instant != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instant = this;
         GameObject.DontDestroyOnLoad(gameObject);
     }
 }
示例#3
0
 // Use this for initialization
 void Start()
 {
     if (instance == null)
     {
         instance = this;
         music.Play();
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }