- Home /
How to save and load inventory?
There is so little documentation or tutorials for saving inventory, at least not a clear one. I'm using scriptableobjects and I have one for item and one for character. Things like saving & loading string, int, float etc are easy to implement. But I have no clue how it would work for inventory since theres stuffs like icon then reassigning the items in the UI when you load the game to what you had and so on.
So far I have a inventory where if I click a button it will add a item to the inventory, and now I want to save it. How can I proceed with this? Thanks.
Answer by cdr9042 · Jan 25, 2019 at 04:28 AM
You can save the list of IDs (List< int>) of every items you have, then when you load that list, from that list of IDs, load the item's data from a predefined list of references like this
Or you can save a list of Objects (List< YourScriptableItem>), and save it using Serialization
Hey thanks for the reply. Would you $$anonymous$$d looking at my project and its scripts? Its a small and just used for prototyping.
I kinda knew it had something to do with lists and with ItemId etc but just not sure how I would implement it into my GameSave$$anonymous$$anger.
I'd really appreciate it if you took a quick look at my small project
link: https://mega.nz/#!X9$$anonymous$$DlQxb!O_maBmSEX-XZLlPGkS$$anonymous$$bFyexTpdOi_qamE156xB28rU
Your answer
Follow this Question
Related Questions
How can i save the games inventory? 1 Answer
Inventory code not working [JS] 0 Answers
Proper item usage design 0 Answers
Inventory loop bolt 0 Answers
How to create a save & load system with: System.Serializable ??? 1 Answer