Search Unity

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,570
    Nope, that's just one of the many things you can't do if you use the Animator Controller system.