• Unity
  • Smart skin loading/unloading from resources & memory

Hi,

We have remade our character skeleton structure - instead of multiple characters with similar skeletons now we use 20+ skins for each characters. Probably that's the proper way how such tasks should be solved.

The question here is about performance and RAM optimization. Each character skin equals to 2048x2048px texture, and takes up to 4mb on the device in compressed format. Having 20+ skins it takes minimum 80mb of RAM.

Before, having separated characters I could manage it manually, but how to deal it using skin switch?

Related Discussions
...

Unfortunately we don't have a comfortable way available yet to load and unload skin textures in a delayed way.
This has been requested on this thread in the past, unfortunately we did not yet get to implement this feature:
How to control texture memory usage for skeleton with skins

Basically you would need to unload and load resources manually, e.g. as in this thread:
How to dynamically load/unload Skeleton Data Assets
This could be done via any delayed loading of assets, e.g. streaming assets, resources, AssetBundles, etc.

Doesn't look like a way to go. I cant destroy the asset as I always have a character on the screen, but in 90% of time only 1 of 20 skins are used.
Weird, such limitations also means that we can't use such structure for asset bundles in the future - we can't just add some new skins to a single skeleton data. Just wondering how other developers work with that?

I did not mean litterally doing the same as in the mentioned thread. If you have only a single character then you would of course not unload it.

Romahaaa escribió

Weird, such limitations also means that we can't use such structure for asset bundles in the future - we can't just add some new skins to a single skeleton data. Just wondering how other developers work with that?

Normal Unity rules apply. You still pack textures into asset bundles and then hook the references up with other asset bundles via code. You just need some code to manage the references. This same rule applies to any references across asset bundles. We also wonder why Unity has not privided more comfortable means of resolving references across bundles automatically, but that's not in our hands.