Example #1
0
 private void InstantiateController()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this);
     }
     else if (this != Instance)
     {
         Destroy(this.gameObject);
     }
 }
Example #2
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this);
        }

        if (!PlayerPrefsX.GetBool(GameKeys.kPrefSoundOn))
        {
            gameObject.GetComponent <Image> ().sprite = soundON;
        }
        else
        {
            gameObject.GetComponent <Image> ().sprite = soundOFF;
        }
    }