== Overview
This article explains the steps to go from an existing customizable object to a playing character that can be modified with an interface automatically generated from the object data.
It covers the following chapters:
* **[[#create-states|Create States]]**: to organize the UI, and so the relevant modification updates are as fast as possible and have the minimum impact.
* **[[#create-data|Set UI data]]** in the Customizable Objects: so the user sees icons and text defined in the current Customizable Object, adapted to the changes of the evolving Customizable Object without manually modifying the UI for each new object artists add.
* **[[#access-data|Access the UI data]]** of a Customizable Object from a Widget: so the widget is created with the relevant content at runtime.
---
= Create States{anchor #create-states}
This chapter covers the creation of Customizable Object States. As an example, sets up of one playing state to use while playing and one character edition state for clothing from on a [[/w/mutable/unreal-engine-4/user-documentation/nodes/object-group/|Group Object Node]].
(IMPORTANT) Each state can contain any number of [[/w/mutable/unreal-engine-4/user-documentation/nodes/object-group/|Group Object Nodes]] and/or any amount of the parameters in the Customizable Object hierarchy: [[/w/mutable/unreal-engine-4/user-documentation/nodes/float-parameter/|Float Parameter Node]], [[/w/mutable/unreal-engine-4/user-documentation/nodes/enum/|Enum Parameter Node]], [[/w/mutable/unreal-engine-4/user-documentation/nodes/color-parameter/|Color Parameter Node]], [[/w/mutable/unreal-engine-4/user-documentation/nodes/texture-parameter/| Texture Parameter Node]], [[/w/mutable/unreal-engine-4/user-documentation/nodes/projector-parameter/|Projector Parameter Node]] or a [[/w/mutable/unreal-engine-4/user-documentation/nodes/group-projector-parameter/|Group Projector Parameter Node]].
Each child object can contain its own states, functionally identical to states defined at the base object.
(WARNING) It's advised to split character edition states into multiple coherent states as more parameters are added to the model. Parameters usually modified together, such as facial features, would go well in their own state, separate from clothing, as it frees resources and the update will be faster. It's uncommon to be modifing the face and the clothes at the same time.
(NOTE) The resulting Customizable Object of this example can be found in the [[/w/mutable/unreal-engine-4/examples/#village-demo | Village Demo ]] in //Content/HowTo/DataDrivenUI// named "DataDrivenUICharacter".
== Assets required
* A Customizable Object with at least one **Group Object Node** in the hierarchy
(NOTE) The asset used in this step can be found in the [[ /w/mutable/unreal-engine-4/examples/#village-demo | Village Demo ]] in //Content/HowTo/RemoveUnseen// named "RemoveUnseen" together with the assets that create it.
== Steps
1) The first step is to create the states at the Customizable Object where they are most relevant. Add two states for the Base Object, at the **node properties States** array.
{F106506}
>In this example, the **Customizable Object** has been renamed "Data Driven UI Character"
---
2) The second step is to create an in-game state to use in situations where there's no plan on changing properties fast. Name the first state created, and make sure the options "Don't compress Runtime Textures" and "Build Only First LOD" are **off**.
{F106756}
>In this example, the **State** has been named "inGame"
---
3) The third step is to create a state to use in a character edition lobby, where many parameter changes are expected. Name the second state created, and make sure the options "Don't compress Runtime Textures" and "Build Only First LOD" are **on**.
{F106758}
>In this example, the **State** has been named "Clothing"
---
4) To finish the edition state, add the parameters are important when the state is chosen. To do so, add as many properties as needed at the **Runtime Parameters** array, and name each one of them exactly as the property that must be included in the state. For this guide it's three parameters, as the **Group Object Node** of group type **Toggle** defines one toggle parameter for each of its objects.
{F106778}
>In this example, we need three parameters, named "Boots", "Trousers" and "Shirt", the **Object Name** property of each object included in the group. We need the names of all the objects in the group only because this group is of type **Toggle**, and this type of group defines an independent parameter for each of its objects, but in the example we want to use all of them under the same state. {F106776}{F106766}
(WARNING) When the parameter comes from a group object node of types **At leat one Option** or **One or None**, the name of the parameter that the group defines is the **Group Name** {F106780}
(WARNING) When the parameter is from a parameter node, the parameter name comes from the property **Parameter Name** {F106764}
---
== Result
This is now a Customizable Object with correctly set states, ready to use under two different conditions by enabling one of its states. It is ready for a game, but contains no interface information to automatically generate one.
---
= Set UI data{anchor #create-data}
This chapter covers the addition of metadata to customizable objects to automatically create an UI.
(NOTE) The resulting Customizable Object of this example can be found in the [[/w/mutable/unreal-engine-4/examples/#village-demo | Village Demo ]] in //Content/HowTo/DataDrivenUI// named "DataDrivenUICharacter".
== Assets required
* One icon image asset for every toggle parameter.
(NOTE) The assets used in this step can be found in the [[ /w/mutable/unreal-engine-4/examples/#village-demo | Village Demo ]] in //Content/HowTo/DataDrivenUI//.
---
== Steps
1) Choose a thumbnail image for each toggle parameter. In each **Child Object Node** of the group, inside the **Parameter UI Metadata** node property, set each chosen image asset as the **UIThumbnail** property.
{F106786}
> In this example, the "Shirt" child object is given the "DDUI_Shirt" image.
{F106794}
> In this example, the "Trousers" child object is given the "DDUI_Trousers" image.
{F106798}
> In this example, the "Boots" child object is given the "DDUI_Boots" image.
---
== Result
This is now a Customizable Object with UI metadata set, ready to be used by the game in any way it sees fit when generating the UI.
---
= Access UI data{anchor #access-data}
This chapter covers how to read the UI metadata of a customizable object to adapt widgets to the character parameters. It includes the usage of the customizable object UI metadata to automatically generate an interface that allows the modification of the character and reads the character state to determine what are the parameter values when it's created.
(WARNING) This tutorial does not cover how to create a playable character, a level or how to setup a basic widget. Those are, however, provided, as mentioned at the Assets Required section. How to create a character from a [[/w/mutable/unreal-engine-4/user-documentation/basic-concepts/#customizable-object-instance|customizable object instance]] of the customizable object that has been made in the previous steps can be done following [[/w/mutable/unreal-engine-4/technical/#create-character| these steps]].
(NOTE) The resulting widgets of this example can be found in the [[/w/mutable/unreal-engine-4/examples/#village-demo | Village Demo ]] in //Content/HowTo/DataDrivenUI//.
== Assets required
* A level to play in
* A customizable object as playing character
* A user interface container widget
* A user interface toggle button widget
(NOTE) The assets used in this step can be found in the [[ /w/mutable/unreal-engine-4/examples/#village-demo | Village Demo ]] in //Content/HowTo/DataDrivenUI//. The widgets initial configurations are "Container_Initial" and "Toggle_Initial".
---
== Steps
**WIP**
---
== Result
This is now a playable customizable object character in a level with an automatically generated UI that allows to change its parameters at runtime.