Hello,
I have been working an an mute/unmute button in the game. The problem is that it does not toggle correctly when pressed. When i press it apparenty it gets togggled both on and off at the same time, leaving the same texture. I have 2 textures for the button, but only the on one appears.
Rect position = new Rect(native_width-175,90,125,125);
GUI.DrawTexture(position , musicTextureToggle);
if (GUI.Button(position , "", new GUIStyle()))
{
if (musicOn==1)
{
musicTextureToggle = musicTextureOff;
musicOn = 0;
PlayerPrefs.SetInt("isMusic",musicOn);
Debug.Log("mute");
}
if (musicOn==0)
{
musicTextureToggle = musicTexture;
musicOn = 1;
PlayerPrefs.SetInt("isMusic",musicOn);
Debug.Log("unmute");
}
}