Hi All!
I’m trying to change a variable in a script during a OnTriggerEnter function in antoher script.
var AddTime : float = 15;
var obj: GameObject;
var script: Component;
function Start(){
obj = GameObject.Find("GUIcounter");
}
function OnTriggerEnter(){
var script: GUICountDownTimer = obj.GetComponent(GUICountDownTimer);
script.restSeconds = script.restSeconds + 10;
print(script.restSeconds);
}
It’s mainly about the line
script.restSeconds = script.restSeconds + 10;
This does seem to change the variable, but in This script, I need it changed in the other script, GUICountDownTimer. How do I do this?
Thanks in advance!