Hunting around on the forums here i thought I found how to using yield to have animation play before the rest of the code executed ,… though I have this bit of code and it seems to totally ignore the yield return WaitForSeconds(animation.clip.length); call…
void Update()
{
if((!firing) (!moving))
{
if(Input.GetKeyDown("space"))
{
StartCoroutine(followPlayerScript.SetAttack());
firing=true;
moving=true;
..start code that starts some other logic and action of projectiles etc... dont want to do this
... until the above is done animating.
}
}
}
THen the function called:
public IEnumerator SetAttack()
{
anim.CrossFade("Staff Spell Forward");
staff.renderer.enabled = true;
Debug.Log("*********************** ANIM LENGHT : " + anim.clip.length);
yield return new WaitForSeconds( anim.clip.length); //should be almost 1 second, even tried 10f and still no pause...
}
Am I missing something? Maybe the forum posts I found are older and not updated for the latest version of unity (4.3 something) I am running?