abuki Strange, I fixed the issue by replacing SkeletonAnimation.Update(0); with SkeletonAnimation.AnimationState.Update(0); in one of our scripts.
Can you tell me the design difference between these methods? Which one should I be using?
There is quite a big difference. SkeletonAnimation.Update
includes AnimationState.Update
, but many more things.
AnimationState.Update(0)
just updates the core AnimationState
and triggers animation-driven callback events, but does not appy the updated animation state to the Skeleton, does not issue callbacks like UpdateLocal
, UpdateWorld
, UpdateComplete
and does not adjust Unity-specific things like updating the Mesh.
You can also check out the SkeletonAnimation.Update(float deltaTime)
source code here.
abuki I see I am using the SkeletonAnimation.Update(0); in many other scripts without problem (probably? not checked all), but now I am unsure if it's safe, and what is the correct use case?
It is in general "safe" and normal to call SkeletonAnimation.Update(0)
. It can however become problematic if you e.g. create hidden infinite loops through circular callbacks (A calling B calling C calling A again) or something like that. I would recommend to attach a debugger and pause in the debugger when the editor is getting stuck. Also you could have a try removing your own custom components bit by bit until the issue no longer occurs, to get a clue how the issue is triggered.