I have a machine showing in below picture:
The machine has two parts, one is red-marked and the other is yellow-marked, each of them has an animation, and both are controlled in one Animator, and now I play one of them, say: AnimationA, and sometime later I want to also play AnimationB.
I have tried several ways, like: build two Animator Layers or make a Blend Tree, but both of them have the problem that when playing one of the them, the other animation will get less playing. Because it is not a Humanoid gameobject, I want the animation to play without any influences by the other.
Maybe I had misunderstood about the Animator Layers or the Blend Tree, if anybody can give me suggestions that will be really helpful and appreciated. Thanks.
Ok, so what you need to do is make an empty state called “null” and set it as default in the animator. Then right click and make a transition between null and AnimationA and then make another transition from null to AnimationB. Now click on parameters (instead of layers) and make 2 bools, animationAPlay and AnimationBPlay. now click on the transition and add the animationAPlay bool as a condition. and have it set to use true. Make another transition back from AnimationA to Null and add the bool as a condition and set it for false. Now any time you want to play the animation call:
Animator.SetBool(“AnimationAPlay”, True), to play the animations or Animator.SetBool(“AnimationAPlay”, False) to stop the animations.
Make sure the animation is set to loop, and your done.