- Home /
If an specifc animation is playing dont let other animations play.
I have a gun with an shooting animation and a reload animation, and a raycast script with a reload function.
Raycastscript is attached to MainCamera
Animations is attahed to the gun
The gun as a childobject to MainCamera
Reload function:
function Reload(){
if (clips > 0) {
transform.FindChild("AUG").animation.Play("reload", PlayMode.StopAll);
yield WaitForSeconds(2);
bulletsLeft = 30;
bulletsPerClip = 30;
clips--;
}
}
The reload animation will play when the clip is empty, but if i try to shoot again the reload animation freezes, the freezing is not the problem, the thing that i can actually shoot while the reload animation is playing is bugging me.
In short
I want to disable the shooting animation when the reload animation is playing.
If anything was confusing please tell me xD
Thanks in advance
Answer by Crystalline · Oct 13, 2013 at 07:05 AM
Written from my phone . But that's how I do it , and it should work in your case too.
if (!animation.IsPlaying("reloading"))
{
animation.Play("shoot");
}
You're my life saviour, after tweaking a bit in my script and inserted your part in it, it finally worked.
Thanks ^^
Your answer
Follow this Question
Related Questions
Raycasting fail 1 Answer
Animation Event calling function 1 Answer
GUI Counter Based on Animation or RaycastHit 0 Answers
Canceling animation.Play functions after being used 1 Answer
how character's legs(tps) move? 0 Answers