- Home /
How do I reset GUI Button to normal state texture(Android)?
Hey all, simple question here I can't quite seem to find the answer to:
edit: (This only happens on the Android build)
Currently, I have a series of simple gui buttons for my menu, which use a GUI skin with separate textures for "normal" and "active" states. The problem is that when I reopen the scene after playing the next level, the last button which was pressed still remains in the "active" state. Yes, I realize there are plenty of simple ways to get around this (I will probably just switch out the GUI skin, rather than use the "active" and "normal" as separate textures, since I can reset that on awake..). But is there a way to reset the button state somehow through code? Been wondering about this for awhile, but SOMEHOW I've never managed to find the answer yet..
Thanks for your time!
Edit:
to open I simply call Application.LoadLevel(5);
the button is just normal isolated button:
function OnGUI(){
if(GUI.Button(Rect((Screen.width / 2) - 115,Screen.height-140,230,150),"PLAY!") || Input.GetKey("return"))
{
if(level > 0)
loadScreenScript.Load(2);
else
loadScreenScript.Load(3);
}
}
forgot to mention also, it's Android build, I think that's a key piece of info, oops!
and now that I check, it ONLY happens on the android build .. updating ...
How do you open your scene? I think what you propose is probably the easiest way to work around that, resetting the GUI when you reload the scene. However it is a weird problem, i've done similar things and didn't encounter such problem. So I'm interested :)
Same problem and behaviour here. Any update? I am still searching for a solution.
Your answer
Follow this Question
Related Questions
How to WaitforSeconds a GuiButton ? 0 Answers
How can I make a gui with buttons pop up in javasript? 1 Answer
Check if GUI is Pressed 1 Answer
Infinite GUI Button positions. 3 Answers
Making a Hover function for a button or toolbar from code. 2 Answers