Hi,
this is regarding SkeletonUtility in Unity and the CollectBones method. I've been looking to remove as much GC allocations from my game as possible, and noticed that SkeletonUtility was allocating every frame. It is due to this line:
spine-runtimes/SkeletonUtility.cs at master
When looping over the bones, it exits early if a BoneFollower.bone is null. This is ALWAYS the case if your GameObject root node is the auto generated "SkeletonUtility-Root" follower (spine-runtimes/SkeletonUtility.cs at master).
What happens is exiting early means the
needToReprocess
flag is never set to false (spine-runtimes/SkeletonUtility.cs at master), and so
CollectBones()
is called every frame when
UpdateLocal()
is called.
This was easily fixed by just changing
return
to
continue
, but not sure what the implications are for others who don't use the SkeletonUtility-Root follower, or if that SkeletonUtility-Root follower is actually a discouraged or out-of-date practice (my project began from the spine asset packs).
Thanks, I was actually also going to look into pooling TrackEntry objects that were created in AnimationState, but I upgraded from Spine 3.4 to 3.5 first and found that you guys already did that! Thanks for the continued awesome work you put into Spine and the runtimes