- Home /
Multiple animations on mouse click?
Hello peoples, I am hoping this is a simple task. I have a char. rigged and a few animations. I am better 3d artist then programmer lol. Never the less they all worked correctly inside unity. Now I am wondering this.
When my main char get close to the "enemy" with animations, How can I cycle through multiple animations with/on mouseclick? I'm gonna use a trigger so it only happens when the Player is near the enemy. Perhaps an array of kinds? I'm not sure! anyone know?
Edit: I feel I should mention the animations are humanoid, not sure if that makes a difference.
Answer by MrYOLO · Feb 28, 2014 at 03:15 AM
I think the Animator in Unity is designed for this, and you can refer to the document. Any question you can comment behind this:)
I took a look, it shows how to set up statemachines. I'm looking for a script to access these animations, I already have them set up.
Edit: Basically, I have exa$$anonymous$$ed an animationController from one of unitys projects, setting up the animator is easy. I'm not sure how to achieve my question above for script accessing the animator.
Here you go: if(Input.GetButton("Fire1")) animator.SetBool("Jump", true ); Then in your statemachines, you can control the loop of your multi animation.
Sweet! I will give it a try even though its only one animation. No idea how I am going to script a mouse click for multiple animations haah, thanks all the same :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613134946im_/https://answers.unity.com/themes/thub/images/avi.jpg)