Hey all,
I’m completely new to scripting and Unity, and I have to finish a Unity project as part of a module in my Master’s course. The logic of scripting still seems to escape me, I can execute all sorts of simple commands but when it comes to combining many different commands into one script I’m lost. Can anyone help me with the following scenario? It would have to be in C#; I’ve seen some solutions to this in Java but our projects need to be in C, and I just don’t have the skills to translate from one language to another. Also I know the new UIs have come with the new update and that they’re more intuitive to use, but we aren’t allowed to use them either, I’m using Unity 4.3 atm.
My game is a simple educational explore-an-environment-and-click-on-things-to-learn-about-them. I have multiple different objects to explore, all with different GUIs. I want to have
-
a GameObject in my scene that when the player collides with it, a question mark GUI appears to let them now it’s possible to investigate the object,
-
and then when they press key X when on this collider area a GUI window with text pops up,
-
when they press X again the window disappears,
-
When they leave the collider area the question mark GUI disappears.
I can make the texture appear and disappear when the player collides with the trigger, I can toggle GUI windows, I can trigger events with the pressing of a key - but I can’t get my head around how to combine these things, as in, what needs to be void onTriggerEnter, what on void Update, what on onGui etc. etc… How to make the condition that this specific GUI will appear ONLY if the player is on this specific area and ONLY if she presses X? Any help would be greatly appreciated!