Skip to main content

Workflow: Creating a Fact Schema

A Schema is the foundation of your data. It acts as a contract, defining every Fact that a runtime Context will contain. This guide will walk you through the four essential steps to create and register a new Schema.

We will create a simple Schema for a player character, defining their health and a boolean flag for whether they are carrying a key.

Step 1: Define Gameplay Tags

Every piece of data in FactsDB is identified by a Gameplay Tag. Before we create any assets, we must define the tags we'll need. It's crucial to establish a clear and consistent hierarchy.

  1. Go to Edit > Project Settings > Project > Gameplay Tags.

  2. Click "Manage Gameplay Tags".

  3. Add the following tags. The dot notation . automatically creates the hierarchy.

    • Schema.Player (This will identify our new Schema)
    • Fact.Player.Stat.Health
    • Fact.Player.Stat.MaxHealth
    • Fact.Player.State.HasKey

Gameplay Tag Editor showing the new tags.

Tag Naming Conventions

A good tag hierarchy is your best friend. A common pattern is: Root.Category.SubCategory.SpecificName

  • Schema.* for Schemas
  • Fact.* for Facts
  • Context.* for Context Prefixes
  • Query.* for Queries

Step 2: Create the Fact Definition DataTable

Now we will create the Data Table that holds the actual definitions for the Facts in our Schema.Player.

  1. In the Content Browser, right-click and select Miscellaneous > Data Table.
  2. In the "Pick Row Structure" dialog, select FactDefinition. This is critical.
  3. Name the new asset DT_PlayerFacts.
  4. Open DT_PlayerFacts. We will now add a row for each Fact in our schema.
  5. Click "Add" to create a new row.

Defining the Health Fact

  • Row Name: Can be left as default.
  • Tag: Select Fact.Player.Stat.Health from the dropdown.
  • DefaultValue:
    • Click the + icon next to DefaultValue.
    • Search for and select the Fact Float struct. This is the wrapper for float values.
    • Set the Value inside the Fact Float to 100.0.
  • bReplicate: Leave this checked (true) so health is networked.

Defining the Health Fact in the DataTable

Defining MaxHealth and HasKey

Repeat the process for the other two facts:

  • Row 2: Player.Stat.MaxHealth
    • Tag: Fact.Player.Stat.MaxHealth
    • DefaultValue: Fact Float, Value = 100.0
  • Row 3: Player.State.HasKey
    • Tag: Fact.Player.State.HasKey
    • DefaultValue: Fact Bool, Value = false
    • Description: (Optional) Add a helpful note like "True if the player is currently holding the dungeon key."

Save the Data Table. You have now defined the structure and default state for your player's data!

Step 3: Register the Schema in Project Settings

The system needs to know that DT_PlayerFacts belongs to the Schema.Player. We do this in the project settings.

  1. Go to Edit > Project Settings.
  2. Navigate to the Game > FactsDB section.
  3. Under Fact Schema Definitions, click the + to add a new element to the map.
  4. Schema Tag: Select the Schema.Player tag we created.
  5. Fact Data Tables: Click the + to add an element to the array, and select our DT_PlayerFacts Data Table.

Registering the Schema in Project Settings

Step 4: (Optional) Configure Schema Inheritance

Our Schema.Player is a base schema. Imagine we wanted to create a "Hard Mode" player schema that starts with less health. Instead of duplicating the Data Table, we can use inheritance.

  1. Add a new tag: Schema.Player.HardMode.
  2. Create a new, smaller Data Table, e.g., DT_PlayerFacts_HardMode.
  3. In this new table, add only one row that overrides the health:
    • Row Name: Player.Stat.Health
    • Tag: Fact.Player.Stat.Health (Must be the same tag to override)
    • DefaultValue: Fact Float, Value = 50.0
  4. In Project Settings, add a new Schema Definition for Schema.Player.HardMode.
  5. Set its Parent Schema to Schema.Player.
  6. Add DT_PlayerFacts_HardMode to its own Fact Data Tables array.

Configuring Schema Inheritance

Now, any component using Schema.Player.HardMode will inherit MaxHealth and HasKey from Schema.Player, but will use the overridden Health value of 50.


With the Schema defined and registered, the next step is to bring it into the game world by adding a UFactsComponent to an Actor.

Next Up: Using Facts in Actors