- Home /
How to save list of Sprites?
Dear coders I was wondering if someone may be able to point me in the direction of how I can save a list of sprites.
I have two scenes :
1 "Shop Scene" - holding all inventory items 2 "Start Scene"
I am able to code for my player to buy inventory items in 1 and transition to 2 with these inventory items as child sprites/gameobjects using a binary formatter.
However, on closing down the game entirely and reloading (I have a load function which works perfectly for health, mana, etc) the list of inventory gameobjects or sprites will not reload. I know that these are not serializable but after a lot of trial and error I've not been able to come up with a logical approach.
Would someone mind pointing me in the right direction as to how I may save this list of sprites that the player has brought?
Thanks!
Answer by bakir-omarov · Jun 10, 2018 at 08:26 PM
Simple way is to give every item the unique ID, and after reloading the game or scene, just check what kind of unique ID's player has, and instantiate them all from your prefabs.