- Home /
What to use for dynamic loading of assets instead of Resources.Load()?
A bit of context: I'm doing a generic modal window, that I can spawn and pass parameters for message and buttons. I'd also like to extend it, to be able to pass an image as well (think of this layout).
Instinctively, I thought to use Resources and load a sprite that I've put in there before hand, but a thought struck me, to see best practices of the Resources API and how much memory its using (and how much should be put in there).
Lo and behold, the official documentation
TLDR: Question: What's the best way to use Resources? Official answer: Don't use it. (Literally bolded and in italics).
Right...That's all well and good but there's no mention of what to use instead and this is far from the only case where I'd like to get resources in such a way (especially sprites/textures, which still don't seem to have a uniform way of being loaded from image files into game sprites...).
So, I'm told not to use Resources. What should I be using instead?
Answer by hexagonius · Dec 28, 2018 at 01:45 PM
if you know all possible assets could be used during a game you just reference them, maybe in the dialogue script directly or as layout container in a scriptable object.
if you want these be extendable without shipping a new build, use asset bundles.
and if using Ressources works for you just do it. so many people are complaining about systems only because they fail in large scale projects or under extensive use, but und small and simple conditions, use it.
The AssetBundle is something I didn't know about, I'll investigate it. Thank you.