I want the game to show the number “5” on the top of the screen .
I made some Spheres so if you click them the are destroyed . I want the number to change to 4 when I click on 1 ball , 3 when I click on 2 balls …
At 0 I want it to Load another scene .
How can I do it ? help please ! THX !
1.-u need an empty game object with an script attached to count to 0 and to display ur text.
2.-u need a GUIText on ur screen.
3.-u need a the script to destroy ur balls.
so based on what u already have.
make an empty gameobject leve it anywhere. this will only hold the previous mentioned script so it wont get destroyed and stop working.
1st script: name it whatever u want ill name it “GUIsphere”
//1st declare a variable to hold ur GUIText and controll its properties and ur cont variable
var referenceToText : GUIText;
var number : int;
//remember to assign the guitext on the inspector tab
//then in the update call the referenceToText and the number and printit every Update
referenceToText.Text = ("Spheres left:"+number);
then on ur script where u destroy each ball. just add the following line
//emptyGameobject is the name of the empty gameobject that holds the GUI script