// Use this for initialization void Start() { if (PlayerPrefs.GetInt("MuteSound") == 1) { //btnMute.image.sprite = muteSprites[1]; GCSurvival survival = FindObjectOfType(typeof(GCSurvival)) as GCSurvival; survival.MuteSound();; } }
// Use this for initialization void Start() { CurrentHealth = initialHealth; GameObject gameControllerObject = GameObject.FindWithTag("GameController"); if (gameControllerObject != null) { gameController = gameControllerObject.GetComponent <GameController>(); survivalController = gameControllerObject.GetComponent <GCSurvival>(); if (PlayerPrefs.GetInt("MuteSound") == 1) { //btnMute.image.sprite = muteSprites[1]; survivalController.MuteSound();; } } if (gameController == null && survivalController == null) { Debug.Log("Cannot find 'GameController' script"); } }