- Home /
Question by
batu · Aug 14, 2013 at 09:56 AM ·
yieldwaitforsecondsyield waitforseconds
Difference between yield WaitForSeconds and yield new WaitForSeconds
Its really simple, I dont see the difference, though. Because I m kinda new to scripting, I have some basic problems. It would be great if you could help me.. The code is below, if you need it.
function OnMouseDown () {
if ( animation )
{
animation.Play ( aniClip.name );
}
else
{
parent.animation.Play ( aniClip.name );
}
if ( GetComponent ( AudioSource ) )
{
yield new WaitForSeconds ( audioDelay );
audio.Play ();
}
Comment
Answer by Joyrider · Aug 14, 2013 at 10:23 AM
In JavaScript the new
is implicit, you do not need to write it :) It is only needed if you code in C#
Have a look at the examples in the ScriptingReference