- Home /
Loading subassets at runtime
Is it possible to load all subassets of a file path just like AssetDatabase.LoadAllAssetsAtPath does, just for runtime?
Resource.LoadAll usually only loads all files from a folder and simply returns the asset at the path if it points to a file, and ignores it's subassets.
Do you know any other alternative I can take a look at?
As a note for a possible solution, if you have control over the main asset (f.$$anonymous$$ if it's a ScriptableObject) it could contain references to every subasset. But this is not a real solution for all cases, though it might work for $$anonymous$$e...
Answer by FortisVenaliter · May 05, 2016 at 03:04 PM
Check out Asset Bundles. You can basically create a package of assets, then load them all in at once, and pick and choose the ones you need.
I know of AssetBundles but it is a completely different thing, they won't allow me to load subassets at all. Incase my question wasn't clear, subassets could for example be ScriptableObjects attached to other ScriptableObjects as subassets (due to the way ScriptableObjects work this is often necessary). I've made this structure in an editor extension, but when I can't load the subassets at runtime I cannot use my editor generated data at runtime. I hope that made it clear why AssetBundles are not an option:)