I have a "burn" animation and a "poison" animation for when the player is burnt or poisoned respectively. I want to play both animations at the same time when the player is both burnt and poisoned. From what I've read this is supposed to be possible with layers, but I can't get it to work.
-
\$\begingroup\$ How have you tried accomplishing this with layers so far? How do the results differ from what you want? \$\endgroup\$ – DMGregory♦ Nov 5 at 19:19
Yes indeed it is possible with Layers.
First create two layer in animator.
Then increase layer "Wight" to 1.
Now set animators like this.
Not Add Two triggers to parameters for may be "Poison" and "Burn":
And assign those parameters to Transitions buy click on transition arrow And also do Transition setting to your need.
- Now At last step set triggers like:
-If poison then:
NPCAnimator.SetTrigger("Poison");
-If Burn then:
NPCAnimator.SetTrigger("Burn");
-If Both then:
NPCAnimator.SetTrigger("Poison"); NPCAnimator.SetTrigger("Burn");
I hop this will help.
If you need more information please let know.
-
\$\begingroup\$ I couldn't get this to work for me. My guess is since the animations are using the same singular sprite renderer, its impossible for unity to play two animations through the same renderer. I found a workaround by just making multiple animators on child gameObjects. \$\endgroup\$ – super potato Nov 13 at 23:02