For example, if I would like to load all the fonts in my game on startup, how do I do this without individually loading each of them? The documentation states that we can load an asset group at once, and it seems there’s a LoadAssets function (which I assume is what the docs refer to). However the function is templated so it looks like it can only load one type of asset… Do I need to call LoadAssets twice with different generic typing? (e.g. Material, TextMeshProAsset, and some other type for TTF assets?) This seems like an absolutely critical feature which should be touched on in the docs.
edit 1:
It seems like the documentation is implying that I would instead use an AssetReference to asynchronously load my font when needed. I assume this will not incur a performance hit since it is loading in the background.
However, doesn’t that mean my text wouldn’t appear until it’s actually loaded while the rest of the game continues forth? If this is the case, the same will probably be true for all sorts of other assets in the game. It sounds like the game would become increasingly janky and amateurish looking as more and more of these assets appear to load in a delayed manner.
And how on earth would I do this anyway considering that TextMeshPro doesn’t use addressables anyway? Create a script solely for the purpose of loading the font and feeding it into TMP at runtime? That would ruin my ability to quickly iterate on the text’s appearance in the editor in prefab mode, since the TMP component would have no font until runtime.
edit 2:
It seems the correct way to achieve this would be to create a label and provide **UnityEngine.Object** as the type.
However I still have all the questions raised in edit 1. In other words, what is the point of loading dynamically as the game is running instead of loading everything required in a loading screen prior?
Even the demos seem confused on this: check out this demo component I stumbled upon. It’s loading its own assets, but there’s no mention of what would happen if the user managed to trigger SpawnAThing() before everything could load. Scenarios:
-
If the user is spending in-game cash to spawn that thing, this is pretty hilariously bad.
-
If this is simply a decorative such as a prefab with particles, then it will appear glitchy and amateurish when the particles don’t spawn for the corresponding action in the game.
So then, what is the point of loading assets on demand like that? Unless I’m misunderstanding, it seems like the Addressable API is going all in on this concept of ‘on demand loading’, when in reality this is actually not at all a desired behavior 99% of the time. I say this because the docs are making it seem as though migrating is simple, simply use AssetReference in place of direct references and load/react as needed, when in fact it can actually change how the game plays. NOT at all what I would expect most developers to want.