0
I cant deal with these errors >:[ any help on this one??
Error: NullReferenceException: Object reference not set to an instance of an object SoundButtionGUI.Update () (at Assets/SoundButtionGUI.cs:27)
Im getting the errors with : if(toggle.value == true)
>> this is the variable: public UIToggle toggle;
if (Application.loadedLevel == 0) {
if(toggle.value == true){
PlayerPrefs.SetInt("SoundMute", 1);
Invoke("audioOff", 0.01f);
} else{
Invoke("audioOn", 0.01f);
PlayerPrefs.SetInt("SoundMute", 0);
}
}
Ive tried this:
if(toggle.value == true && toggle != null && toggle.value != null && toggle.value != false)
Also: if(toggle == true) which stops the error but the code does not work because toggle sometimes returns null
Any help would be great
Any help would be great, I have had loads of these errors and have had to ask on here for every single one -_-