1. Home
  2. Docs
  3. Unity SDK
  4. Motive UI System

Motive UI System

The Motive.io Unity SDK includes a powerful UI system that allows for the rapid development of screens.

Prerequisites

This will assume a basic level of understanding Unity and its associated UI components.

It will also assume a basic understanding of some basic technical concepts, like what a stack is.

Overview

The Motive UI system consists of several parts.

Motive.io Panel

An example of a panel.

The Panel Manager
  • The panel manager allows for the management of arbitrary stacks of panels. That is, you can push and pop panels, or create new stacks as needed.
  • A panel manager is a singleton class that extends panel container.
  • The panel manager is responsible for managing which panels are currently visible and for sending them to screen when they should become visible.
    • To send a panel to the top of the stack use the PushPanel<T> method.
      • Often this will be called by a button.
Panel Container
  • A panel container is a class that contains and manages panels.
  • Most users will use the panel manager class instead of the panel container class directly.
Panel
  • A panel is a unity “screen”. That is, it is one screen that the user would see when looking at your application.
  • Here is an example of creating a simple panel.
  • There are some excellent examples of using panels in all three of the templates. In fact, all of the templates use the Motive UI system.
  • Generally you will want to extend the panel class for each panel that you need.
  • Panels have three animations associated with them all of which are of type Runtime Animator Controller.  This allows for you to attach any animation that you would like for when panels show and hide.
    • Push Animation
    • Pop Animation
    • Close Animation
  • Panels have several useful methods that you can hook into
    • SetActive
      • Sets this panel instance to active.
    • Populate
      • Populate is where you want to put any logic that is needed to populate the panels data. For example, querying some data source.
    • Linked Objects
      • A set of game objects that are linked to this panels state. That is, if this panel is active, so are the others.
      • If this panel is not active, neither are the others.
    • DidShow
      • Occurs when a panel shows.
    • DidHide
      • Occurs when a panel transitions from showing to hidden.
    • DidResignTop
      • Occurs when a panel is no longer at the top of the stack.
    • DidRegainTop
      • Occurs when a panel is once again at the top of the stack.
    • DidPush
      • Occurs after a panel has been pushed onto the stack.
    • DidPop
      • Occurs when a panel has popped from the stack.
    • Close
      • Calling this method on a panel will close the panel and the next to pop from the stack will show.
    • Back
      • Closes the panel and entire stack with it.
    • PushPanel
      • A quick way to push a panel onto the stack and display.
Table Panel
  • Motive Unity Table Panel

    Example of a table panel

    A table panel is a panel that contains a table of panel items.

  • Selectable table items allow for you to hook into a user selecting items within the table. This is useful for things like a user inventory where selecting an item allows for the user to inspect it.
  • The Table Panel Class contains several methods that you can hook into
    • Awake:
      • This is the method that runs when the panel is first created. Logic that is used t populate the
    • SetSelectedItem:
      • Sets the currently selected item.
    • OnSelectItem:
      • Occurs when an item is selected. Hook into this if you want to run something when a user selects an item.
    • Reset:

Articles

Was this article helpful to you? Yes No

How can we help?