Quantcast
Viewing all articles
Browse latest Browse all 16

Using De-serialised Data in a build

Unity can't serialize Dictionaries, so I figured I'd just use a list instead. Turns out Unity can't handle polymorphism either (which is an absolute must for me). The class I'm trying to work with is an ItemDatabase which holds a dictionary of item. Items are put in as different children (Sniper, Staff, Consumable, Armour, etc.) and also retrieved and cast. I've managed to serialize this class using the system binary formatter. My first question is: How can I get a filepath as decent as possible? I am now using `Application.dataPath + "/Resources/ItemDatabase.dbs"` to both load and save. Now for my second, most important question: Saving and loading this database works, so does using the data inside of the database. However, since I've saved the Database to D:/Unity/Assets....etc it won't load when I actually make a build of the game. How can I make sure the game knows where my database is located in a build?

Viewing all articles
Browse latest Browse all 16

Trending Articles