1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\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
1
\$\begingroup\$

Yes indeed it is possible with Layers.

  1. First create two layer in animator.

    enter image description here

  2. Then increase layer "Wight" to 1.

    enter image description here

  3. Now set animators like this.

    enter image description here

  4. Not Add Two triggers to parameters for may be "Poison" and "Burn": enter image description here

  5. And assign those parameters to Transitions buy click on transition arrow And also do Transition setting to your need.

    enter image description here

  6. 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.

\$\endgroup\$
  • \$\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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.