newbee here with a question
So I call this function from another script using sendmessage and inject a value named time. time is used to calculate the speed. Speed is used in the same script. However function movebar never seems to return speed. Debug.log shows me that speed is = 1 for instance, but outside the function it remains 0.
what am I doing wrong.
var speed : float;
function movebar (time :float) : float
{
var speed :float = 0;
speed = 1 / time;
Debug.Log(speed);
Debug.Log(time);
return speed;
}
function Update () {
var step = speed * Time.deltaTime;
loadingbar.position = Vector3.MoveTowards(bar.position, bartarget.position,step);
}