I was referred to the Unity documentation, which states that the Best Practice for Resources.Load is to not use it.
Instead, to use AssetBundles.
I went through the documentation several times, on multiple pages (tuts, best practice, api, etc.), and it was quite confusing, but not after I was convinced by Unity that AssetBundles are definitely the way to go. Nowhere can I get a clear or complete answer as to how & when assetbundles and their assets are loaded into memory. Not their manifest files. Not one specific asset. The entire bundle.
I downloaded Unity’s AssetBundleManager & sample scenes, and outside the editor they throw an error about not being able to download from my localhost IP. Same problem as seen here but as far as I can tell, there is no resolution.
This sucks. Especially since I am not using AssetBundles to download anything via WWW. No internet required. I was just converting my project by supplanting Resources.Load with AssetBundles, as was told to me by the Unity documentation. I eventually came to realize, looking through AssetBundleManager’s code, that it is specifically made for all the things I don’t need (downloading asset bundles from an external server).
So hours later I decided to stop with AssetBundleManager & removed it from my project. Ugh. I then read to put my AssetBundles in “StreamingAssets” folder inside of Unity, because that is how I am using them: included with the initial full game download. Creating my own assetbundle manager, I begin to test loading the bundles.
AssetBundle bundle2 = AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/AssetBundles/Windows/" + "global_player");
I notice the profiler isn’t displaying anything loaded into memory. So when is the AssetBundle actually loaded into memory? Is this just loading the manifests?
Did I just waste several days of my life working hard to read through the documentation, (fail to) understand AssetBundles, and then realize Unity’s suggestion to “Not use Resources.Load” is wrong? Should I just be using Resources.Load? This is so incredibly frustrating. Even the documentation seems inconsistent from page to page, and most of it requires the AssetBundleManager which doesn’t work for me outside the editor.
For the love of god, I just wanted to load my Prefabs into memory so my game’s framerate doesn’t hitch when I instantiate. Resources.LoadAll() makes this so easy. Why the hell are AssetBundles so incredibly complex even when they’re all going to be local files? And how is this best practice? It may be nice updating after the fact, but getting it setup is a PITA, and others have told me they don’t even use it for that - they make their own custom patcher. So in what world is this “best” when Resources.Load() seems to work fine & when you need something more you make a custom solution?
I wouldn’t have spent so much precious dev work days if I knew this wasn’t going to be as easy as it sounds.
- Create the AssetBundle
- Load the AssetBundle only when I want
- Instantiate from the AssetBundle
Nothing about this is simple. And I’ve read multiple doc pages, repeatedly.