Hello everyone ! Im having a problem with my score system for my 2D Game.
My code goes like this
var score : int = 0;
function Start ()
{
}
function OnCollisionEnter(theCollision : Collision)
{
if(theCollision.gameObject.name == "Score")
{
Debug.Log("Pokupljen score!");
score = score + 1;
}
}
function OnGUI ()
{
GUI.Label(Rect (10, 10, 100, 20), score.ToString());
}
I created a object and called “Score” i put the script on my player but it doesn’t work ! Pleas help me ! Thank you ![]()