chanon

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?
chanon
  • 記事: 5

Harald

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.
アバター
Harald

Harri
  • 記事: 1514

chanon

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.
chanon
  • 記事: 5

Arnissan

An option to export individual skins only would be amazing.
Arnissan
  • 記事: 66

Harald

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.
アバター
Harald

Harri
  • 記事: 1514

maasha

Bump on this.
maasha
  • 記事: 6


Return to Unity