Search Unity

Question How do animation events find their functions on a gameobject?

Discussion in 'Animation' started by lejean, Jan 30, 2021.

  1. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    If I just assign a string function to the animation like in the picture does this do some kind of "Iterate over all the components" untill it finds a function with that name?

    How performant is this when you have alot of components?
    If a result is found is this then cached or does it do a lookup every time the animation plays?

    animation event.png
     
  2. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
  3. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    Sigh
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,570
    Just open the profiler and do some performance tests. I never bothered benchmarking them because I know they aren't very efficient or even convenient to use so I just made my own event system for Animancer.