Skip to content

UI Bindings and Hosts

This page explains how PlayMaker maps data fields to UI targets.

The binding system is intentionally host-agnostic. UI bindings do not know where data comes from. Host components provide the schema and values, and bindings describe how fields map to UI targets.

Binding Model

Hosts supply:

  • The schema as a DataDefinition
  • The value source as cells

Bindings supply:

  • The mapping from fields to UI targets

DataUIBindings

DataUIBindings is the serialized container for UI binding configuration.

It contains:

  • AutoBind for editor-time auto binding
  • List<DataFieldBinding>

It does not contain a DataDefinition. The schema is always provided by the host component.

DataFieldBinding

DataFieldBinding maps one schema field to one UI target.

FieldGuid -> IDataFieldTarget

IDataFieldTarget

UI targets implement IDataFieldTarget to receive values from the binding system.

void Apply(IVariableVar value, DataDefinition definition, SerializableGuid fieldGuid);

Built-in examples include:

  • TextTarget
  • ToggleTarget
  • SliderTarget
  • ImageSpriteTarget

You can implement custom targets to support additional UI components.

DataItemUI

DataItemUI is a MonoBehaviour used by collection widgets such as tables and grids.

It owns:

  • DataDefinition for the item prefab schema
  • DataUIBindings for UI mapping

It also provides runtime context for UI actions:

  • ItemId
  • ItemKey
  • IDataUIActionHost

It is used by:

  • DataTableWidget
  • DataGridWidget (planned)

DataComponentUI

DataComponentUI is a MonoBehaviour used by single-record UI, such as HUD panels and inspect panels.

It owns:

  • DataUIBindings

It gets its schema and values from the attached DataRecordComponent.

DataRecordComponent
  -> DataRecord
       -> DataDefinition
       -> Cells

It automatically refreshes when DataRecordComponent.Changed fires.

DataComponentUI does not currently process actions.