Some time ago, Unity added the ability for AudioClip audio data to be loaded or unloaded on demand using the functions LoadAudioData and UnloadAudioData. This seems like a generally awesome feature: I can have a fairly lightweight AudioClip asset reference in my prefabs and scenes, but only load the “heavy” audio data, and use up memory, when I need.
The alternative to this would be to use the Resources system, which has the downside of not being able to use asset references in a prefab and the potential for typos in asset names, or asset renaming causing Resources.Load to fail.
I actually experience this scenario frequently with Textures, so I’d love a similar method for dealing with texture data. I have a scenario where 20+ textures are linked up to various prefabs - when I run the game, all these textures are loaded into memory. I really only need to have maybe 3-4 of these textures loaded at one time…so at this point, I guess I need to use the Resources system, which requires me to move all my texture assets and replace direct references with string references.
It would be great for textures to have a similar “preload texture data” flag and LoadTextureData/UnloadTextureData functions exposed. In the scenario described above, I could easily optimize my memory usage by changing a few texture import settings and some code. A texture without the data loaded could still provide some important info: name, height, width, format, mipmaps, etc.
So, I’m wondering: since this sort of functionality was implemented for audio assets, is there any chance that we’d see something similar for textures? Or are there technical constraints specific to textures that would make it impossible? After seeing this feature on AudioClip, it feels like a way more elegant solution for finer-grained memory management than using the Resources.Load mechanism.