Add data objects

To add new custom data to Databrain, simply follow these steps.

  1. Create a new class (for example EnemyData) with some fields and derive from DataObject.

using Databrain;

public class EnemyData : DataObject
{
    public int health;
    public float strength;
}
  1. Save the file and wait for compilation.

  2. Create a new DataLibrary object in your project. Right click in the project view and select: Create / Databrain / Data Library

  3. Open the DataLibrary. You can now find your newly created EnemyData type in the global namespace category.

  1. Select the EnemyData type and click on create.

Categorization and more

You can categorize data types by namespace, data types and derived types. For example, following code:

using Databrain;

namespace Enemies
{
    public class EnemyData : DataObject
    {
        public int health;
        public float strength;
    }
}

Sub type:

using Databrain;

namespace Enemies
{
    // Derived from EnemyData
    public class Orc : EnemyData
    {
        // Orc specific fields
    }
}

Results in this:

You can also define a color and icon for your data types. Please read the attributes section for more information:

pageDataObject attributes

Last updated