Please note that the part in Pharan's post "If you swap out a SkeletonAnimation's SkeletonData asset, it needs to reinitialize and orphan old objects and allocate memory for new ones." depends on the situation, and might be incorrectly worded.
In general:
1) SkeletonData needs to be loaded once for each type of skeleton (so for a SkeletonDataAsset
). This will be loaded with the first skeleton instance.
2) When creating an instance, instance data skeletonAnimation.Skeleton
and skeletonAnimation.AnimationState
needs to be created.
So by creating a pool for each skeleton type (for each SkeletonDataAsset
), you still benefit of moving the load-time to e.g. the start of a level. This optimizes item (1) above.
If you have a single SkeletonGraphic
object and swap out SkeletonDataAsset
references and thus need to re-initialize it, you don't gain (2). This is what Pharan described as "will not help much".
Regarding how to best pool SkeletonDataAssets:
Probably the easiest way would be to write a script that holds a List of SkeletonDataAsset
s and then upon Start()
loads each SkeletonData by calling e.g. skeletonDataAsset.GetSkeletonData(true);
. [Edit: removed an unnecessary line that turned out to be redundant]