I’m wondering what I’m doing wrong with static functions? I don’t see what i’m doing wrong but it doesen’t seem to call uppon the static function? it does give errors if say I type the wrong function name or something??? grrr.
this is the code I use to call the static function:
#pragma strict
var shake = false;
var shakeTime : float;
function OnGUI()
{
if (GUI.Button(Rect(Screen.width / 2 - 50,25,50,25),"ShakeIt!"))
{
Shake.shake(shakeTime,transform);
}
}
And this is the static function(it is in a script called 'Shake"), this not in the scene just in the project file.:
static function shake(lengthTime : float, shakeTransform : Transform)
{
var endTime = Time.time + lengthTime;
while (Time.time < endTime)
{
shakeTransform.position = Vector3( Mathf.Repeat(Time.time, 0.1), Mathf.Repeat(Time.time, 0.1), shakeTransform.position.z);
yield;
}
}
Thoughts?