Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Animation event - triggers three times

Discussion in 'Animation' started by legendaryious, Nov 11, 2020.

  1. legendaryious

    legendaryious

    Joined:
    Oct 28, 2020
    Posts:
    4
    I have an animation with no content but the animation event on 0:00.

    Loop is disabled for this animation.
    I did read that Animation events have issues with being triggered first frame in animation, but I wasnt able to find a solution or a workaround for this.

    Any recommendations ?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    I recommend checking out Animancer (link in my signature) which is a much better animation system and has its own Event System that doesn't have any issues with events not getting called (as far as I know, and if it did then I could fix them much faster than Unity fixes things).

    But having an empty animation is a prety unusual use case. What are you trying to achieve with it? Maybe there's a better way to approach the whole problem.
     
  3. legendaryious

    legendaryious

    Joined:
    Oct 28, 2020
    Posts:
    4
    Probably isn't worth it to implement a whole new system just for this one event I use.

    My problem is a little different :D
    I have an animator which has 9 states created in a circle.
    First eight of these states I override everytime they played through. I use the 9th state to trigger the overwrite. Hence the 9th state triggers the overwrite of 1-8 and sets a trigger to start the circle again.

    I was doing research and found the animation event, which would be quite handy to trigger once for the overwrite.
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,486
    A StateMachineBehaviour might be the way to go. You could use the OnStateExit of the 8th state and wouldn't need the 9th at all.
     
  5. legendaryious

    legendaryious

    Joined:
    Oct 28, 2020
    Posts:
    4
    Ok I read about it somewhere..not sure how to use it with animatior, but guess I get research done about this, thank you !