Hi All!
I’m trying to make a Checkpoint system for a race game. I got a onGUI countdowntimer script, and each time crossing a checkpoint I want to add a certain amount of seconds to the timer.
This is the script I added on to the checkpoints:
var AddTime : float = 15;
function OnTriggerEnter () {
var script = GetComponent(GameObject.GUIcounter/GUICountDownTimer);
print(script);
print(script.restSeconds);
script.restSeconds = script.restSeconds + AddTime;
}
Unfortunately, and probably obviously to some of you, this doesn’t work, and returns Null for the script var… What is wrong with this, and how would I get it to work? Í try to acces the script GUICountDownTimer.js and the variable restSeconds, wich is added to the gameobject GUIcounter…
Thanks in advance!!!