How demanding is StateMachineBehaviour?

Hi, everybody, I’m still at war with the end of the animation.

It’s about mobile games, LWRP, 2019.2.

How much will it affect the optimization, if, for example, on each necessary animation there will be a script StateMachineBehaviour, which once in OnStateEnter receives “IAnimationEvent _receiver” and caches it, then sends a call.

That is, if there are 15 such animations, it means that there will be 15 StateMachineBehaviour scripts that once receive the IAnimationEvent component and keep it in memory.

This is just one enemy. If there are 20 enemies.

20 * 15 = 300 StateMachineBehaviour scripts that are called only when their animation is started.

Or is the load very low and I’m wasting my head?

I want to make sure I get a callback through the animator itself at the end of the animation. Optimized on the mobile device.


I have an additional question. I create a group and put a script with the OnStateMachineExit method on it.

Why do all nested groups also have this script at startup? What is the load? Does this mean that each animation will have its own script working separately? Or it is simply displayed, in real life the script works only at group?

HELP ME ???