How can i start animation in the Update Function Then Play Anther animation without repeat playing the first animation?
Use animation.PlayQueued or have your update function test if the normalized time of the previous animation is 1 before starting the second.
actually this is my first try so please answer me
var timeranimation : float = 5 ;
var startwalking: float =4;
var startWalking= true;
function Start(){
animation.wrapMode= WrapMode.Loop;
animation["StartWalking"].wrapMode= WrapMode.Once;
}
function Update(){
if(Input.GetKey("w") && onceenable == true && !animation.IsPlaying("Run")){
animation.CrossFade("OnceRun");
timeranimation -= Time.deltaTime;
if(animation.IsPlaying("OnceRun") && !animation.IsPlaying("Run") && timeranimation >4 ){
run();
onceenable =false;
}
}
if(Input.GetKeyUp("w")){
timeranimation = 5 ;
onceenable = false;
}
}
function run(){
animation.CrossFade("walk");
}
actually this is my first try so please answer me
var timeranimation : float = 5 ;
var startwalking: float =4;
var startWalking= true;
function Start(){
animation.wrapMode= WrapMode.Loop;
animation["StartWalking"].wrapMode= WrapMode.Once;
}
function Update(){
if(Input.GetKey("w") && onceenable == true && !animation.IsPlaying("Run")){
animation.CrossFade("OnceRun");
timeranimation -= Time.deltaTime;
if(animation.IsPlaying("OnceRun") && !animation.IsPlaying("Run") && timeranimation >4 ){
run();
onceenable =false;
}
}
if(Input.GetKeyUp("w")){
timeranimation = 5 ;
onceenable = false;
}
}
function run(){
animation.CrossFade("walk");
}
Try this it might help.
animation["StartWalking"].layer = 1; // Place the Walk animation on a higher level
animation["StartWalking"].blendMode = AnimationBlendMode.Additive; // Set the blend mode to Additive so it will blend
// into whatever animation is playing when it's called
animation["StartWalking"].wrapMode = WrapMode.Once;
animation.CrossFade("StartWalking"); // Play the animation