Please note GDE no longer uses PlayerPrefs to persist modified data. To persist your data, call the new Save method when it is convenient in your game. Be sure to save as often as you need. Web builds still use PlayerPrefs (Save and ClearSaved methods have no effect in Web builds).

// To persist modified data call.. 
// To clear any persisted data call..

Modifying a Custom Field

Suppose your Character item looked like this:

Arrok’s chest Armor is set to LeatherTunic. For this example, let’s say the LeatherTunic was defined like this:

Change Arrok’s chest Custom Field to another Armor item, say ChainMail, you can set the chest Property to the ChainMail’s object.

// Load Arrok's data
GDECharacterData arrok = new GDECharacterData(GDEItemKeys.Character_Arrok);
// Load the ChainMail's data
GDEArmorData chainMail = new GDEArmorData(GDEItemKeys.Armor_ChainMail);
// Set Arrok's chest Property to the chainMail object
arrok.chest = chainMail;

You can modify Custom Lists in a similar way. You can modify a Custom list by adding new entries, removing entries, or changing existing entries. After modifying a Custom list, you must call it’s Set method.

// Load the shop, chainMail, and leatherTunic's data ...

// If shop had a List<GDEArmorData> armorInventory
// you would be able to add entries
// remove entries
// Change any particular index to a new entry
shop.armorInventory[0] = leatherTunic;
// Once you are done modifying, call Set!

Modifying a Custom Field’s Data

Modifying a Custom Type’s Fields follow the same rules as modifying basic and list fields. List fields require calling their Set method. Here’s an example where I modify values on Arrok’s chest armor.

GDECharacterData arrok = new GDECharacterData(GDEItemKeys.Character_Arrok);
// Modify any data on Arrok's armor using the Properties on chest 
arrok.chest.attack_power_delta = 20; += " (Enchanted)";
// .. some time later
// Reset custom fields in a similar way
// Reset all fields on a custom type