- Home /
Delay between animations
How do i put delays in my script i get the following error...
Script error: Update() can not be a coroutine.
I am very noob so be nice, I want it like this.
function Update () {
if (Input.GetButtonDown ("Fire3"))
animation.Stop("Run");
animation.Stop("Walk");
GetComponent(Fast).enabled = false;
animation.Play("Skid");
yield WaitForSeconds (5);
GetComponent(Slow).enabled = true;
Fast and Slow are both Third Person Controllers
This is just an example But lets say i wanted to switch from a character movement with no item in hand animation set to animation with item in hand animation set.
So in simple terms Player Stops moving, Animation Fast Script is disabled, Animates Skid Yield gives time for the animation to skid then the second set of animations begin
Answer by Mortennobel · Apr 23, 2011 at 09:12 PM
Take a look at these pages:
http://unity3d.com/support/documentation/ScriptReference/index.Coroutines_26_Yield.html
http://unity3d.com/support/documentation/ScriptReference/WaitForSeconds.html
Basically what it says is that Yield WaitForSeconds can only be used inside a function started as a Coroutine.
Your answer
Follow this Question
Related Questions
Unity, AI script errors... please help 0 Answers
Why do I get error when using yield? 1 Answer
Pause script errror. 1 Answer
problem at adding script 1 Answer
Bullet Script 2 Answers