@fengmin You can register your own components to the skeletonAnimation.OnAnimationRebuild
callback to get notified when Initialize(true)
invalidates e.g. your skeleton and AnimationState
.
skeletonAnimation.OnAnimationRebuild -= InitializeOnRebuild;
..
protected void InitializeOnRebuild (ISkeletonAnimation animatedSkeletonComponent) {
Initialize();
}
You can find the same code in SkeletonRootMotionBase.cs
:
EsotericSoftware/spine-runtimesblob/4.2/spine-unity/Assets/Spine/Runtime/spine-unity/Components/RootMotion/SkeletonRootMotionBase.cs#L179