- Home /
how to i play another animation when the first one is finished
So basically what i want is like secondary weapon system so when scroll the mouse up my secondery weapon pops up. I done the showing part but how do i make it so that if i scroll the mouse wheel the primary w eapons put away anumation plays and once thats ended the secondary weapons draw anim plays.
$$anonymous$$ay be this will help you: http://docs.unity3d.com/ScriptReference/Animation.PlayQueued.html
This is achieved through a simple transition + Exit time parameter in "Animator" Component with $$anonymous$$ecanim.
Animator is a different component to the one @JustFun mentioned above, which is the Legacy "Animation" Component.
Erm, ok? Go with JustFun's method then :D
For your information, though, $$anonymous$$ecanim is generally also script controlled.
Some people prefer Legacy :P
Answer by kacyesp · Aug 26, 2014 at 05:45 PM
Open the Animator (Window -> Animator).
Create a transition from one animation to the other. You just right click on the animation want to transition from and click "Make Transition" and then left click on the animation you want to transition to.
In the bottom left of the Animator window you should see "Parameters". You'll want to add one ( probably of type bool ) by clicking the "+" sign.
Next click on the arrow representing the transition from one animation to the other and in the Inspector, set the condition to the parameter you created.
Then in a script, you want to use:
Animator animator = GetComponent(); animator.SetBool( "nameOfTheParameter", / boolean based on mousewheel / );
I'd give you the mousewheel code too, but I have yet to do something like that. This should definitely get you close to your goal though.
O thank you so much bur can you give mousewheel code thanks.
Your answer
Follow this Question
Related Questions
Switching weapons with PUN 2 0 Answers
Weapon switching 1 Answer
Player Weapon Scripting 1 Answer
Creating an inventory/weapon array and ability to scroll through it 1 Answer
Firearm tutorial 1 Answer