1. Enter Your Game Data Using GDE Editor

  • First, create a schema with the Schema Editor

  • Second, create your data items with the Item Editor

2. Generate Your Data Classes

To generate the GDE Data Classes use the Generate GDE Data Classes menu action.

Note: GDE Data Class naming convention is: GDEschema_nameData.

3. Include the GameDataEditor namespace

Include the GameDataEditor namespace at the top of any source files where you will access GDE.

using GameDataEdtor;

4. Initialize the Game Data Manager

There are 2 ways to initialize GDE. From bundled Resources or from a TextAsset.

From Resources:

Include your data file in your game’s Resources by placing the data file in a /Resources path. For example: "Assets/GameDataEditor/Resources/gde_data.txt". Initialize GDE by passing the file name without the file extension:

GDEDataManager.Init("gde_data");

The location of this file is set in the GDE Free Preferences pane in Unity Preferences.

From a TextAsset:

You can load GDE data from a bundled TextAsset like this:

// Adapted from Unity3D AssetBundle Docs
var payload = new WWW ("http://example.com/myBundle.unity3d");
yield payload;

TextAsset gde_data = payload.assetBundle.Load<TextAsset>("gde_data");

if (!GDEDataManager.Init(gde_data)) {
  Debug.LogError("Error initializing!");
}

5. Read your data

The generated GDE Data Classes provide properties for reading your GDE data items.

If your Item was defined like this:

Read it by calling the constructor of the data class of the item you’d like to load with the item’s key.

// Make sure GDE is initialized BEFORE reading any item data
void LoadTunic()
{
  GDEArmorData tunic = new GDEArmorData(GDEItemKeys.Armor_LeatherTunic);

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

Note: The GDEItemKeys class will contain constant strings of all your item keys. Use it to prevent typos in your scripts.

6. Supported Data Types

// bool
bool boolVariable;
List<bool> boolListVariable;

// int
int intVariable;
List<int> intListVariable;

// float
float floatVariable;
List<float> floatListVariable;

// string
string stringVariable;
List<string> stringListVariable;

// Vector2
Vector2 vector2Variable;
List<Vector2> vector2ListVariable;

// Vector3
Vector3 vector3Variable;
List<Vector3> vector3ListVariable;

// Vector4
Vector4 vector4Variable;
List<Vector4> vector4ListVariable;

// Color
Color colorVariable;
List<Color> colorListVariable;

// Unity Types
// GameObject, Texture2D, Material, and AudioClip
// Are supported in Full Version

7. That’s it!

If you have questions you can post a message on the forum or send me an email.