Skip to content
Model VistaModel Vista Create Unity Package Documentation

State Selector Sample

The optional State Selector sample adds a runtime UI for viewing Model Vista State Sets and selecting their options in Play mode. The selector uses the names and thumbnails configured on each State component, so you can test the same presentation data that is available to other Model Vista runtime interfaces.

State Selector Sample displaying the State Sets for a helicopter and a car in Unity

  1. Open Window > Package Management > Package Manager.
  2. Select Model Vista Create.
  3. Open the Samples tab.
  4. Select Import for the State Selector sample.
  1. Add or select a GameObject with a UI Document component.
  2. On UI Document, assign the sample’s ModelVistaCreatePanelSettings asset to Panel Settings. The Source Asset can remain empty when you use the layout generated by the sample.
  3. Add the Model Vista State Selector component.
  4. Set Target to the root GameObject whose Model Vista State Sets you want to display.
  5. Enable Include Inactive when State components on inactive objects in the target hierarchy must also be available.
  6. Assign the hosting UI Document component to UI Document.
  7. Set Dropdown Alignment to position the expanded State Set controls for the available screen space.
  8. Enter Play mode and select an option to apply it to the target.

The selector header shows the target name and the number of available State Sets. Expand a State Set to view its options; a check mark identifies the currently selected option.

The runtime panel uses the Model Vista State data configured on the target:

  • Configurable Name supplies the State Set heading.
  • Display Name supplies each option label.
  • Thumbnail supplies the optional State Set or option image.
  • UI Visibility controls whether a State Set is available to runtime UI.

To show separate panels for multiple models, configure a UI Document and Model Vista State Selector for each target. Use Dropdown Alignment and the UI Document’s Sort Order to keep the panels readable alongside other runtime UI.