I’ve the following code snippet on iOS (iPhone + iPad):
bool showPlayButton = true;
void OnGUI()
{
if (showPlayButton)
{
if (GUI.Button(CreatePlayButtonRectangle(), "Play"))
{
showPlayButton = false;
// do something
}
}
}
Once I tap the Play button, the Play button will disappear. It works as expected.
After finishing the game, I set
showPlayButton = true;
The Play button shows up again as expected.
However, it does not disappear when I tap it again. I was expecting to hide the button again.
What did I do wrong?
Thanks in advance for your help.
You're correct. I found the bug.. Thanks.
– anon566966In my tests, GameObjects that are instantiated from script do get a reference to the scene in which they were instantiated, so their
– Max-Pixelscene.nameis not null.