WaitForSeconds using Update?

The script has no complier errors before the game starts. However, once the game starts, I get an error that says “Update () cannot be used as a coroutine”. I’ve searched the web for a couple hours now, but I can’t seem to find a way to re-write my script, and make it work. I’ve re-written it a couple times, but I’m stuck as to what to do right now. If anybody could help me solve this, it would be much appreciated. Thanks in advance.

    var jumpslash : AnimationClip;
    
    var doingsomethingelse : boolean = false;
    
    function Update ()
    {

    if(doingsomethingelse==true)
     {
    yield WaitForSeconds (2.0);
    doingsomethingelse = false;
    }
    
    if(Input.GetKeyUp(KeyCode.F))
    {
    if(doingsomethingelse==false)
    {
    animation.Play("jumpslash", PlayMode.StopAll);
    doingsomethingelse = true;
         }
    
     }
    
    }

First, a google search for “Update () cannot be used as a coroutine” yielded(heh) the answer in the first two results.

You can’t use yield in update in UnityScript.

Move your call into another function

var jumpslash : AnimationClip;
var doingsomethingelse : boolean = false;

function Update ()
{
	if(doingsomethingelse==true)
	{
		WaitASec();
	}

	if(Input.GetKeyUp(KeyCode.F))
	{
		if(doingsomethingelse==false)
		{
			animation.Play("jumpslash", PlayMode.StopAll);
			doingsomethingelse = true;
		}

	}
}

function WaitASec ()
{
	yield WaitForSeconds (2.0);
    doingsomethingelse = false;
}