- Home /
How to load scriptable objects during runtime in build
So I've been designing an inventory system where you create meta data of an item which includes information such as item id, item information, max stack size etc., and these data are stored inside a scriptable object. Now the inventory system I'm designing involves a global static class (called InventorySystem) from which I should be able to pull out or add an inventory item when I provide appropriate parameters such as item id or a unique tag. Now the hurdle I'm facing right now is to create some kind of a lookup table or dictionary which stores all the meta data, since all the meta data are scriptableobjects and they can be only loaded using AssetDatabase. AssetDatabase works when you are able to store the references inside a serialized lookup, however in my case I'm using a static class. So saving references is not possible. Therefore my only option right now is to load scriptable objects during runtime without using AssetDatabase since AssetDatabase is an Editor class. Is there anything I can do differently? Or is there a solution I'm missing out?