The Data Model at a Glance

Follow one Health Potion from editor catalog to runtime UI. Each UIS object owns a different part of the result, and editing the wrong layer is the most common cause of a change that appears to have no effect.

The ownership chain

Layer Health Potion example What it owns
Database GameInventoryDatabase The catalog container and registered objects.
Category Consumable Inherited structure and attributes shared by related definitions.
Definition Health Potion The reusable template and definition-level values such as Icon and Description.
Item One runtime Health Potion The runtime object; mutable Item attributes can differ per instance.
Item Stack Health Potion ×3 One Item plus its amount inside a collection.
Item Collection Bag Where stacks live and which restrictions or purpose apply.
Inventory Player Inventory The owner of Bag and any other collections.
Item View Potion slot icon A UI presentation of Item data; it does not own the Item.

The Item Definition editor shows a definition's category, attributes, and relationships.

The Inventory Inspector shows collections and starting Item amounts for the runtime owner.

The runtime Inventory Grid presents Items read from the bound collection.

Decide where an Attribute belongs

Ask these questions in order:

  1. Does every descendant of a Category share the same structural field? Declare it on the Item Category.
  2. Does every Item created from one Definition share the same value? Store it in Item Definition Attributes.
  3. Can two Items from the same Definition have different values? Store it in Item Attributes and use a mutable category when required.
  4. Is the behavior more complex than data? Use an Item Action, Item Object Behaviour, or project system instead of an Attribute expression.

Examples:

  • Icon and Description normally belong to the Definition.
  • Attack normally belongs to the weapon Definition.
  • Durability belongs to the Item when two Iron Swords can be damaged differently.
  • A Consume operation belongs to an Item Action, while its healing amount can be data.

Distinguish data from scene objects

An Item is not a GameObject. An Item Object binds Item data to a scene object for a pickup, equipped object, or another visible representation. The Inventory and UI can use Items without spawning an Item Object.

Verify the chain

Select an Item Definition, enter Play Mode, locate its Item Stack in Bag, then select its Item View. Confirm that each layer points to the same definition but owns different data and lifetime. Change only the definition Description and verify that the UI updates without replacing the Inventory.

Continue learning

  • Terminology provides the complete glossary.
  • New Database builds the shared multi-category example.
  • Defining Attributes covers inheritance, Override, Inherit, and Modify.
  • Item covers runtime identity and definition relationships.
  • Inventory covers collection types and restrictions.