• Runtimes
  • Multiple on screen instances of the same skeleton / different skins

I have a spine project with about 20 skins that share a single skeleton (and animations). As many as 100 instances from this one project can be on the screen at once in my game.

My question is - when I create each of the 100 characters should I call mySkeleton = SkeletonAnimation::createWithJsonFile(filename, atlasname, scale); which seems to load the entire thing again, or is there some way to load the skeleton and all the skins 'once' and have all the on-screen characters reference that? It seems to me that since each is in its own animation state and skin configuration this would be difficult. However it feels very inefficient to load all 20 skins over and over for each character who is only using one, and also if any are using duplicate skins it feels inefficient as well. Am I missing an obvious runtime solution?

Related Discussions
...

You should only load the data once, eg createWithData. What runtime are you using?

Cocos2dx. Ok it sounds like you're saying to only use createfromJSON once then use loadwithdata after that? Any good directions for how to do that already out there?

Thanks!

Ah I see it in the BatchingExample.cpp. I can't find where I originally copied from but I was using
mySkeleton = SkeletonAnimation::createWithJsonFile(filename, atlasname, scale);
which does load all of it every time

  • Nate оценил это.