• Unity
  • How to control texture memory usage for skeleton with skins

Related Discussions
...

I currently have a skeleton with animations that are reused by a lot of characters in the game.
So I have all of the character skins in that skeleton.

I thought spine-unity would only load the textures needed to draw a skin into memory when that skin is being drawn. However, using the memory profiler, I have found that spine-unity loads ALL textures used by ALL skins into memory... even if a single skin is being used.

Is it possible to make it only load textures for skins that are actually being drawn?

Please note that normal Unity behaviour regarding loading of any dependent assets applies.

E.g. when you are using an instance of raptor-pro_SkeletonData in a scene:

  • this instance references the raptor-pro_SkeletonData asset
  • the raptor-pro_SkeletonData asset references raptor-pma_Atlas
  • raptor-pma_Atlas references raptor-pma_Material
  • raptor-pma_Material references the atlas texture raptor-pma.png.

Normal means of delayed loading of assets appies, e.g. streaming assets, resources, AssetBundles, etc.
Please note that you can combine and repack single Skins, Attachments or Sprites to new atlases at runtime.
Please see the documentation page for more info.

Thank you.

Is there a way to export the skins from Spine separately from the skeleton so that they can be applied at runtime without having to repack them as new atlases at runtime?

Currently I have each character skin's textures in its own folder and when I export the skeleton each character skin has its textures in its own png file.
The skeleton's "Atlas" asset however references all materials and textures, so they are all loaded as you explained above.

I don't need to dynamically recompose/repack a new texture, I just need to (or want to)

  1. Export the skeleton without the skins
  2. Export the skins separately .. maybe each one has their own "Atlas" file
  3. At runtime switch the Atlas file to one of the skin's Atlas file ... or in some other way just load and switch the material

How would I do that?

Not sure if you understand or if I'm misunderstanding anything, but the key thing is I don't need to "repack a new texture" or create a new material at runtime, I just need to use the existing ones but control when they are loaded.

An option to export individual skins only would be amazing.

I see your point. I will think about whether we can provide or suggest simple means to achieve a way of deferred loading of skins.

2 months later
2 years later

May I bump this and ask if a change is still in consideration?

10 months later

Great, thanks!


Hi Harald,

Happy new year. Is this improvement still in the pipeline?

Hi, Harri is currently on vacation. He'll get back to your post when he returns.

6 days later

Happy New Year! Sorry for the late reply.

This feature is of course still on our roadmap, just unfortunately we still didn't get to it yet, very sorry about that!