niezhijing :I don't know if there is a way to release them, they take up too much memory,Is it because Kamiya_Atlas is still citing them?
Yes, your observations are correct. The textures and materials cannot be released due to the following chain of references:
-
Your skeleton component (e.g. SkeletonAnimation
) references SkeletonDataAsset
.
-
SkeletonDataAsset
references SpineAtlasAsset
.
-
SpineAtlasAsset
references one or more Materials
, one material per original atlas texture.
-
Each Material
references an original atlas Texture
.
Now to allow releasing the original atlas textures, you would need to break the chain at any of the above links (e.g. by setting the references to null
). If you need the assets again later and re-load them, you could use any of Unity's delayed loading mechanisms instead of direct references, like Addressables, Asset Bundles, Resources, and the like. You would then "manually" handle loading and unloading of these memory-heavy assets.