Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Detect when Any State is used

Discussion in 'Animation' started by Noxalus, Dec 15, 2020.

  1. Noxalus

    Noxalus

    Joined:
    Jan 9, 2018
    Posts:
    80
    Hello everyone!

    I would like to detect when my Animator is passing by Any State, something like this:

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class AnimatorTest : MonoBehaviour
    4. {
    5.     public Animator Animator;
    6.  
    7.     private void Start()
    8.     {
    9.         Animator.OnAnyState += OnAnyState;
    10.     }
    11.  
    12.     private void OnAnyState()
    13.     {
    14.         Debug.Log("The Animator just passed by the Any State.");
    15.     }
    16. }
    Do you know if there is a way to know that?
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,592
    Nope, that's just one of the many things you can't do if you use the Animator Controller system.