public void onClickSoundToggle() { if (SoundToggle.isOn) { diceScript.soundAllowed = true; //for prefab diceControllerScript.setSound(1); //for available objs } if (!SoundToggle.isOn) { diceScript.soundAllowed = false; //for prefab diceControllerScript.setSound(0); //for available objs } }