Are My AssetBundles Being Unloaded On Me Without My Doing So?
I have a very strange issue I'm hoping someone could shed some light on (mobile app)... at least offer somewhere to look. I have 6 AssetBundles in my game that are getting loaded at startup. I create an assetDictionary of name-references for all the objects in my AB's. Then, when I need one of those assets, I'm use the dictionary to point to the correct AB from which I attempt to LoadAsset. However, in my "new install flow", when I attempt to LoadAsset from an AssetBundle, it returns null. If I run once more (now not through my "new install flow" - some user profile data has been stored on disk), those same LoadAsset calls which returned null now return their valid objects.
Obviously, I could simply have some mysterious problem in my code, but I believe this started happening when I went from 5 AB's totaling 15MB in size to 6 AB's totaling 27MB. I also read in some of the documentation that once we're out of caching space, the least recently used AB will be unloaded.
So, I'd love to find a way to see a log or event when the AB gets unloaded on me, if this is happening; or at least have some way of knowing the status of my AssetBundle... viewing its object in the debugger at runtime offers zero insight into the availability of its contents.
Any assistance here would be much appreciated.
Thanks.
So, I tracked down in my code what action was causing the AssetBundles to return null. I have in my logic, many of these ScriptableObjects being created at runtime (AssetDatabase.CreateAsset). Obviously, this only happens in Editor, and when I call this at a time when the asset to be created already exists (again, this is at runtime), appropriately, the CreateAsset API first deletes the existing asset and proceeds to create a new one. However, the loss of this asset then somehow invalidates all of my AssetBundles...
In other words, doing CreateAsset on an asset that already exists at runtime within the Editor causes loaded AssetBundles to be invalidated.