Search Unity

Button triggering animation not working

Discussion in 'Animation' started by dukeweezo, Sep 13, 2021.

  1. dukeweezo

    dukeweezo

    Joined:
    Jul 22, 2021
    Posts:
    6
    Hi, I'm trying to create a simple set up where a button triggers an animation that changes blendshapes (a bird opening / closing its wings). Right now I have
    • An empty state ("New State")
    • Animation (called "anim-open"), created by changing blendshape values from 0 to 1 at various timeframes while recording in the "Animation" window (looks correct when I preview it)
    • Animator controller -- attached is a screenshot of the set up
    • The model has the Animator added as a component and is checked
    • The Button has the model under OnClick with Animator.SetTrigger (string) and trigger name ("open") added
    When I go to play and test it, the button doesn't do anything. However, when I manually activate the trigger in the Animator window (the circle next to the trigger in the screenshot), the animation works. It also doesn't complain in the console about not being able to find the trigger. I suspect I'm missing some (obvious?) setting somewhere but haven't been able to find it despite watching various videos, intense searching, etc.. I'd greatly appreciate any suggestions. Thanks, Screen Shot 2021-09-13 at 3.00.01 PM.png
     
    Last edited: Sep 13, 2021
  2. dukeweezo

    dukeweezo

    Joined:
    Jul 22, 2021
    Posts:
    6
    For anyone interested, I had made the Button's OnClick point to the wrong object -- I had pointed it to a wrapper entity that contained various meshes, but I had to point it to the specific mesh that had the Animator component attached to it. Oops!
     
unityunity