Q:

Is there a reason why only one coroutine works in my code?

I have an enemy which currently attacks all the time, with no stopping in between attacks. I want to make enemy wait amount of time before he attacks again to simulate enemy "resting" and giving player a chance to attack him while not attacking. I needed coroutine to finish my animation playing so it can go to idle animation while waiting:
IEnumerator Attacking()
    {
        yield return new WaitForSeconds(animLenght);
        isAttacking = false;
    }

I have made another coroutine to wait for a second before enabling attacking again, but it doesen't work. Enemy attacks without brakes, like coroutine doesen't work:
IEnumerator WaitForAttack()
    {
        yield return new WaitForSeconds(1);
    }

I have put WaitForAttack() coroutine in my Attack function:
private void Attack()
    {
        StartCoroutine(WaitForAttack());
        isAttacking = true;
        StartCoroutine(Attacking());
    }

I would like to know what I'm doing wrong with coroutines, as I have just started using them, and this problem is troubling me for a very long time now. 

A:

The documentation for MonoBehaviour.StartCoroutine says

StartCoroutine function always returns immediately

So the Attack method will not wait after calling StartCoroutine(WaitForAttack()); and set isAttacking = true; immediately. Instead, set isAttacking in the coroutine itself. Also do both in the same coroutine to ensure the operations are performed in sequence. Otherwise both coroutines will run at the same time in parallel.
IEnumerator WaitAndAttack()
{
    yield return new WaitForSeconds(1);
    isAttacking = true;
    yield return new WaitForSeconds(animLenght);
    isAttacking = false;
}

private void Attack()
{
    StartCoroutine(WaitAndAttack());
}

