(javascript) Is it possible ? and how to set Time.time as variable ?
var Timer : Time.timeSinceLevelLoad;
(Doesn’t work, got an error)
(javascript) Is it possible ? and how to set Time.time as variable ?
var Timer : Time.timeSinceLevelLoad;
(Doesn’t work, got an error)
Yes, you can send the current time. It’s just a float value.
var myScript : MyScript = GetComponent(MyScript);
myScript.MyFunction(Time.time);
or just
SendMessage("MyFunction", Time.time);
And you are using a value as a type, it won’t work. The type if timeSinceLevelLoad is float.
Try using this:
var Timer : float = Time.timeSinceLevelLoad;
or if you want to set it in Start:
var Timer : float;
Timer = Time.timeSinceLevelLoad;