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. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    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:
    79
    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,332
    Nope, that's just one of the many things you can't do if you use the Animator Controller system.