Problem with corroutine

I try to make an ennemy so that the ennemy be alert, wait 10 seconds, become suspicious wait 10seoncds becore normal again.

I tried with a coyuroutine but it does not work and it something past immédiate from alert mpde to normal mode, to suspicious mode, is it possible I dont understand the coroutine logic or how to write it.

I start my corroutine in the update when certains condition start(and there is a condition so that the suspiciouscourtine does not start when player is in alert mode)

    public IEnumerator SuspicousMode()
    {

            Suspicious = true;
        yield return new WaitForSeconds(delay);
        Suspicious=false;



        yield return null;
    }
//
//
    public IEnumerator AlerMode()
    { 
        Alert = true;
        Suspicious = false;

        yield return new WaitForSeconds(delay);
        if(mySighListernetTemplate.iSeeYou==false)
        { 
        Alert=false;
        StartCoroutine (SuspicousMode());
        }
        yield return null;
    }

Please use code tags, will make it easier to help you.

Unity have a really good tutorial that goes through what you are trying to do here.

You probably want line 23 to be:

yield return StartCoroutine(SuspiciousMode());

Use “StartCoroutine” if you want it to start the coroutine but keep going, use “yield return StartCoroutine” when you want it to wait until the coroutine finishes before it keeps going.