Class DataPersistenceSample
This class manages the scene for showcasing the data persistence sample.
Inherited Members
Namespace: UnityEngine.GameFoundation.Sample
Syntax
public class DataPersistenceSample : MonoBehaviour
Fields
mainText
We will need a reference to the main text box in the scene so we can easily modify it.
Declaration
public Text mainText
Field Value
Type | Description |
---|---|
Text |
wrongDatabasePanel
Reference to the panel to display when the wrong database is in use.
Declaration
public GameObject wrongDatabasePanel
Field Value
Type | Description |
---|---|
GameObject |
Methods
AddHealthPotion()
Adds a health potion item to the inventory manager. The health potion Inventory Item first needs to be set up in the Inventory window.
Declaration
public void AddHealthPotion()
AddNewSword()
Adds a new sword item to the GameFoundationSdk.inventory. The sword Inventory Item first needs to be set up in the Inventory window.
Declaration
public void AddNewSword()
Load()
This will un-initialize game foundation and re-initialize it with data from the save file. This will set the current state of inventories and properties to be what's within the save file.
Declaration
public void Load()
RemoveAllItems()
Removes all Inventory Items from GameFoundationSdk.inventory.
Declaration
public void RemoveAllItems()
Save()
This will save game foundation's data as a JSON file on your machine. This data will persist between play sessions. This sample only showcases inventories, but this method saves their items, and properties too.
Declaration
public void Save()