hi ,
i’m trying to create a Toggle button for play and pause.
when i press the current button it is supposed to generate a new button. but in my case it not working mean time it prints the console message.
here is my code:
var icon_play:Texture;
var icon_pause:Texture;
var play;
function OnGUI()
{
play=GUI.Button(Rect(10,Screen.height-60,50,50),GUIContent(icon_play));
if(play)
{
GUI.Button(Rect(50,Screen.height-80,50,50),GUIContent(icon_pause));
print(“button clicked”);
}
}
what is wrong with this ? can you help me?
thanks in advance.