I am scripting noob. I am trying to create a HUD that will show the time that you have spent in a level, and allow me to also script the incrementing of some other values. In addition I want to move an object that will show the user how their location in the level. I am a PHD student building an simulation that can teach users about transportation choice. I have attached a mockup of the GUISkin that I want to use. If you look at the mockup, every thing that has a ### or zeros are values that I want to be able to control.
Thanks in advance
you can use
rectposition is a rect that you can define as a public or private variable in class scope and change it's x and y values to move your gui element. display var is a variable containing a string that you can change whenever you want. to calculate the time past you can use the Time class variables and simple subtractions. timeSinceLevelLoad is what you want i think. it tells you the time past since level loaded. i don't know how do you want to guide the user and just can say if you want to move the gui smoothly, you should use coroutines. you can display images with strings in your label too (a arrow for example). the second argument of the GUI.Label can be a GUIContent that contains image and string. also you can use DrawTexture to display images too. be careful to take care of resolution. you can use the Screen class for getting values about resolution.
answered Jan 27 '10 at 08:08 PM
This is a very simple approach, it should work fine.
Using GUIText for those text values you want to change realtime and a GUITexture for the background. Keep in mind you'll need to change z-depth values to make sure GUIText renders over the background GUITexture.
All GUIText will need to update their text attribute from a control script.
For the player position, just another GUITexture controlled by a script which changes its X position should work.
answered Jan 13 '10 at 11:26 AM
just use something like this:
replace the X's with the cordinates for where you want them to show up on screen, and the Y's with the size. Use number like (10,10,100,100) for example. Wish you the best of luck with your game!
answered Oct 14 '12 at 11:12 AM