Animator scripting and transition tracking

Hi,

I’m using an animator controller and my own state machine to control my player. Each state is a blend tree. I’d like to be able to :

  1. Check weither a transition happened or not
  2. Interrupt a looped animation when it ends to change the animator’s state

About n°1, the only idea I have is by using hashes comparison but I do not like this because it requires making a condition in the update.
Also, adding an event in the curves doesn’t seems like a good solution because of the number of animations (2D animations with 8 directions).

About n°2, I didn’t really find a solution for this… The only possibility I see is by following the animation cycle by using its length, and stoping when I want it and when a cycle ends. I really don’t like this one.
Btw, I didn’t find anything about blend trees’ length, how does it actualy behave ?

For now I’m using a coroutine that just changes my own state machine’s state by waiting for the time of the animation, but I’d really like to find a better solution.
Is there a way to access the current animation from the animator ? Or a list of currently played animations ?