Hi, I am working on a small unity project. I am trying to implement a scoring system where one would put there first person controller in a positions, say off the plane, and their score would go down. This is the code I have so far which currently does not work properly:
static var Counter : int =5;
function Update ()
{
var player = GameObject.Find("First Person Controller");
if(player.transform.position.y <-10)
{
Counter++ -1;
}
}
Here is the gui script:
var windowRect : Rect = Rect (20, 20, 120, 50);
function OnGUI(){
windowRect = GUI.Window (0, windowRect, WindowFunction, "Score: " +addToScore.Counter); }
function WindowFunction (windowID : int) {
addToScore.Counter.ToString();
}