- Home /
Question by
rdkla · Dec 18, 2013 at 04:03 AM ·
javascriptjava
how to delay a object from moving
I apologize for this but I am not not new to this engine i just have been out of it for 2 years and just now getting back in...
with my lines of code i remember i can add code to make it delay for seconds and return but i dont remember how to write it and the unity script reference doesnt show or im looking in the wrong place please point me in the right direction thank you here is my code again.
function OnMouseOver ()
{
iTween.MoveTo(gameObject,{"x":1});
}
function OnMouseExit ()
{
"Delay":4;
}
Comment
Best Answer
Answer by hirenkacha · Dec 18, 2013 at 04:09 AM
function OnMouseExit ()
{
yield StartCoroutine(WaitAndDo(4.0));
}
function WaitAndDo (waitTime : float)
{
// suspend execution for waitTime seconds
yield WaitForSeconds (waitTime);
// Do what you want after waiting
}
thank you so much it was yield not delay thank you so so much.
Your answer
Follow this Question
Related Questions
Is it the same javascript 1 Answer
RayCast Hit and look at target different objects 0 Answers
UnityScript equivalent of JavaScript objects 2 Answers
Enemy following Player in range 2 Answers