- Home /
When exactly is OnStateUpdate called for different AnimatorUpdateMode-s?
The documentation on this is pretty sparse, and the LifeCycle Events page doesn't mention it.
The tl;dr here is, I'm trying to co-opt the animator as a generic state machine, which will also involve updating a physics object, and hence necessitating something akin to FixedUpdate timing to ensure stable simulation.
I think I have a way around this regardless, but if the AnimatePhysics setting makes OnStateUpdate happen in the FixedUpdate phase, it could potentially simply things a whole lot.
If you found your answer, can you post it and mark the question as soved?
I haven't attempted to use your suggestion to test for an exact answer, presently I am using a pretty hacky workaround via abstract classes and setting some meta-state from OnStateEnter in a "base" state class...
Answer by lgarczyn · Nov 10, 2019 at 12:45 AM
There's a pretty easy way to find out. Simply print the current Time.fixedTime both in the physics loop and the OnStateUpdate call, and see which is first for each frame.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                