- Home /
Battle Info
I'm working on space sim. What I want to happen is, when a missile is shot at your player, I want a GUI to appear and tell you how many seconds before it hits, and if you evade it/get hit by it, I want the GUI to disappear. I'm not asking for anyone to give/write me a script, I'm just asking about how to go about doing it. Thanks.
I cant answer this precisely without knowing how you have build the rest. This sort of question belongs in the Unity community where discussions are made. Sorry.
Answer by Waz · Aug 02, 2011 at 11:07 PM
You put code in OnGUI to do what you describe. There is no special technique relevant to this - just code what you have written in the question. Specifically:
to make GUI "appear" and "disappear": draw it or not
to show a number of seconds: show a label of that number
to change when hit/evaded: when hit/evaded, change inputs to the script
Your next step should be to code this up, try to get it working. If you then find questions of technique or coding, you can ask those as further specific questions.
Ok, but what I meant was, how should I actually write that in script
Unless you're asking for "with a text editor", isn't that the equivalent to "Please write my script for me?"
Seriously, what you need to do is make a start: try to work it out for yourself. You'll learn heaps in the process. If you get stuck, we're here to help.
Sorry, I was pretty new when i wrote that question. I pretty much have everything I asked for up, so thanks for your advice.