// Access text field void Start() { globalData = ChangeSceneScript.Instance; updateField = true; // Get music configuration musicToggle.isOn = globalData.musicOn; // Add listener to change of toggle musicToggle.GetComponent <Toggle> ().onValueChanged.AddListener( delegate { globalData.setMusic(musicToggle.GetComponent <Toggle>().isOn); }); // Add listener to Play button playButton.onClick.AddListener(() => { globalData.ChangeScene(); }); }
public void setMusic() { globalData.setMusic(musicToggle.isOn); }