Saving & Loading
How to save & load Inventool data.
Last updated
How to save & load Inventool data.
Last updated
Inventool doesn't have an internal method of saving data, as it's not a save system. However, it does provide a way for save systems to use save and load Inventool's data. Any save system that uses JSON or binary serialization should be able to save Inventool's data.
There are 4 things of Inventool that require saving: items, enchantments (applied to items), equipment, and currencies. You can use Inventool.CreateSavableData
to get an object that contains all of this data. This method will return a InventoolSavableData
struct.
Use Inventool.SetData
and provide a InventoolSavableData
object as the parameter to load data. This will set the inventory items, equipment, and currencies.
When setting data, no events are invoked. So, for equipment, it may be necessary for you to manually check which items the player has equipped (and enable/disable any necessary GameObjects based on that).
The code below is how you can save Inventool's data with . ESave is my own save systemâit's entirely free and it's been tested with Inventool. ESave is not a requirement, you can use the save system of your choice. However, the example below will only work with ESave.