function OnGUI()
{
GUI.Label(Rect(10,10,100,20),"LIVES: " + lives);
}
how can i get it to display and stay on screen during the game time. The only time this function work is when I click the fire button it appear and it disappear once I release the fire button.
The code you posted does stay on the screen all the time.
–Eric
it does stay on the screen except that the script has to be attach to an active game object. In my case I attach it to the bullet so it only appear when I hit the fire button. the reason I attach this scrip to this game object because this script has a variable that I need to use. I can easily add this script to my player but if I do I cannot access the variable that I need in this script. I’m kind of new to Unity so I’m not familiar with scripting yet.
You can access a variable on another script using GetComponent presuming you have a reference to the object you want to interact with. Your bullet surely doesn’t know the number of lives does it?
Anyway there are some tutorials and other bits on GetComponent here.