I want to make a GUI texture that only appears at certain points. As in when the players walks into a certain area a question box will appear that they have to answer.I don’t know how to get the box to appear at certain times as it is constantly on my screen. I thought of using a oncollision fuction but not sure if this is the best route
Also after the user has answered the question by clicking one of the buttons I want the ‘question box’ to disappear.
Any help would be hugely appreciated. Both these things are probably simple to do but I am very new to scripting
The easiest way as Nicholas pointed out to me when I had a similar question is to simply attach the GUI script (with function onGUI () etc) to an empty game object and disable that script until you need it. Then, say, when the player does something, enable the script, get the input you need, and then disable that script again.
The cool thing is that you could have dozens of GUI-based dialogues all attached to a single game object that are all disabled on start (the GO doesn’t get killed off as you load different play levels) and you simply enable whatever one you need depending on what the player triggers/does.