07Mr07
1
Hi, Im trying a RTS game. I use gui.button to select type of soldiers and spawn it in map, each click on map spawns one soldier.
I need to counter that clicks to control how many soldiers have been spawned.
I can’t find nothing, someone can help me?
Thanks in advance 
var i : int = 0;
function OnGUI()
{
if (GUI.Button(Rect(10,10,50,50),btnTexture))
{
i += 1;
}
}
This should count each click on the button and store the number in “i”.
07Mr07
3
Maybe you don’t understand me 
I did with :
if(Input.GetMouseButtonDown(0))
{
cont++;
}