Note: Before using any GDE Data Classes, be sure to initialize GDEDataManager first. You only need to initizlize it once. You can init from resource bundle, init from a url, or init from an assetbundle.

Loading an Item Using a GDE Data Class

To read your data, use the generated GDE Data Classes. If your Item was defined like this:

The variable you want to declare to read this item will be:

GDEArmorData tunicData;

GDEDataManager loads items by instantiating the data class and passing the key of the item you’d like to load to the constructor.

GDEArmorData tunicData = new GDEArmorData(GDEItemKeys.Armor_LeatherTunic);

Note: Use the GDEItemKeys class instead of passing hard coded strings when loading items.

Here is a full example of how to read the example Armor (LeatherTunic).

using GameDataEditor;

// Somewhere inside a class..

void LoadTunicDemo() {
  GDEArmorData tunic = new GDEArmorData(GDEItemKeys.Armor_LeatherTunic);

  // Do something with tunic data
  int totalHP = tunic.hit_points_delta + 100;
}

Reading Data Using a GDE Data Class

One you’ve loaded your item into a GDE Data Class, reading the values from it is straigtforward. You can access the item values by Field Name. Using the Armor Leather Tunic example from above, you can read its data like this:

GDEArmorData tunic = new GDEArmorData(GDEItemKeys.Armor_LeatherTunic);

tunic.hit_points_delta;
tunic.cost 
tunic.name;

// etc