示例#1
0
 void Start()
 {
     persistentMusic    = GameObject.FindObjectOfType <PersistentMusic>();
     ballModelChooser   = GameObject.FindObjectOfType <BallModelChooser>();
     volumeSlider.value = PlayerPrefsManager.GetMasterVolume();
     ballModelChooser.selectedModelIndex = PlayerPrefsManager.GetBallModelIndex();
 }
示例#2
0
 void Awake()
 {
     if (!singleton)
     {
         singleton = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#3
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
    public static PersistentMusic Instance; // Instance of Theme Music

    void Awake()
    {
        // Destroy if an Instance exists or assign this as Instance if not
        DontDestroyOnLoad(this);
        if (PersistentMusic.Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
示例#5
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
            return;
        }



        DontDestroyOnLoad(this.gameObject);
    }
	// Use this for initialization
	void Start () {
		musicManager = GameObject.FindObjectOfType<PersistentMusic> ();

		volumeSlider.value = PlayerPrefsManager.GetMasterVolume ();
		difficultySlider.value = PlayerPrefsManager.GetDifficulty ();
	}