Runtime database load

Shanmukh

Member
I am implementing asset bundles.
in the first step, I got an issue, if I build a single empty scene, all the assets from inventory also come in the build. how to avoid those from empty scenes.
 
The InventoryDatabase is a scriptable object, all the ItemCategories, ItemDefinitions, etc.. are also scriptable objects referenced by the InventoryDatabase.

Usually I recommend you keep those loaded in memory at all times and only use the asset bundles for heay attributes (Sprites, Prefabs, other scriptable objects, etc...). You do that by creating attributes of type AddressableReference

This will ensure your InventorySystemManager will work as expected when loading the inventory database. but you aren't loading all the large assets in memory at once, instead you load them manually when needed.


If you want to not load the InventoryDatabase in an empty scene (this should be automaticly done by Unity to be fair, not sure why that's not the case on your end). You can set the InventoryDatabase and all its dependencies (ItemCategory, ItemDefinitions, etc..) inside the an asset bundle. But then you will need to be very careful in when it is loaded in memeory and when you assign it to the InventorySystemManager. Personally I wouldn't recommend it.
 
Top