Components in State Machine

A State Machine diagram is built by combining core components such as States and Transitions. Typically, a set of states are interconnected through transitions to represent the flow of logic.

The following eight types of elements can be used as components of a State Machine in the Scene Composer. These components are available in the toolbar at the top of the State Machine Editor panel and can be added to the diagram using a simple drag-and-drop action.

Initial State

The Initial State is a special state that marks the starting point of the State Machine. Every State Machine contains exactly one Initial State. When the State Machine is executed, processing always begins from this Initial State.

drawing-4-1737960437.png

State

A State represents a specific logical condition within a State Machine. It reflects the current operation and context of the system. Specific actions can be executed when a State is entered or exited:

These actions can be configured in the Properties Panel or the Fusion Editor after selecting the target State.

drawing-4-1737960451.png

Transition

A Transition represents a connection between two States and is executed when specific conditions are met.Each transition consists of:

Transitions are evaluated in the logical order defined within the State Machine. If multiple transitions originate from the same State, you an assign priorities to determine which transition should be executed first. For more details, see here.

drawing-5-1767963927.png

Subchart

A Subchart is a structure that groups one or more States and Transitions into a single unit. In the diagram, the lower-right corner of a Subchart is marked with an “S” to distinguish it from a normal State.

drawing-4-1737960507.png

Subcharts can be connected to other States or Subcharts, enabling the creation of flexible and modular flow structures. Double-clicking a Subchart opens its internal details, allowing you to view and edit its contents.

Because Subcharts can be edited independently of the main diagram, they are ideal for organizing complex logic into smaller, easy-to-understand sections.

drawing-4-1737960576.png

Entry/Exit Point

Entry Points and Exit Points are pseudo-states that enable controlled entry into and exit from a Subchart. They serve as clear starting and ending positions for navigating a Subchart.

drawing-4-1737960601.png

Using Entry and Exit Points enables the creation of modular and condition-driven flows within complex State Machine diagrams.

Example of Subchart Configuration Using Entry/Exit Point

The following example shows a simple configuration that incorporates a Subchart along with Entry Points and Exit Points.

drawing-5-1767970403.png

In the figure above, the Subchart named "SubChartState_1" is placed within the State Machine diagram.

  1. The state machine starts at the Initial State in the base diagram (see left figure above). From there it transitions into the Subchart state "SubChartState_1".
  2. Inside the Subchart (see right figure above), the flow begins at the SubChart's Initial State and proceeds to State_2.
  3. A mouse click triggers "Transition_5", moving the flow to State_3 within the Subchart.
  4. Another mouse click initiates a transition via the Subchart's Exit Point.
  5. And returns to the base diagram at State_1.
  6. A subsequent mouse click transitions to the base diagram's "State".
  7. With yet another mouse click, "Transition_3" in the base diagram is triggered, leading to the Entry Point of SubChartState_1 (orange frame in the left diagram). This re-enters the Subchart via the Entry Point and returns to State_3 inside the Subchart..

History State

A History State is a special State that can be placed inside a Subchart. Its purpose is to remember the last active state within the Subchart. When the flow transitions back into the Subchart, processing resumes from the state that was active immediately before exiting, rather than starting from the Subchart's Initial State.

Subcharts that contain a History State are marked with an "H" in the top-right corner of the Subchart in the diagram.

drawing-4-1737960626.png

Example of History State Configuration

The following example demonstrates a simple configuration where a History State is placed inside a Subchart. This setup allows the State Machine to resume from the last active state within the Subchart when re-entering, rather than starting from the Initial State.

drawing-4-1737959821.png

In the figure above, the State Machine diagram contains a Subchart "Media". The Subchart itself includes a History State instead of an Initial State.

When exiting the Media state and transitioning to the Navigation state, the system executes not only the OnExit actions of the Media state, but also the OnExit actions of the last active Media device state (e.g. Bluetooth, USB or Radio).

When entering the Media state, the system executes both levels of OnEntry actions: the Media state's OnEntry actions and the OnEntry actions of the stored most recently selected Media device state (e.g. Bluetooth, USB or Radio).

For an example implementation that demonstrates the use of a History State within a Subchart, see State Machine Solution.

Note

In the State Machine Editor, you can add Notes to the diagram to provide additional information, such as TODOs, caveats, implementation details or design considerations. Notes help improve clarity and make complex diagrams easier to understand and maintain.

drawing-4-1737960773.png

Choice

A Choice element allows you to branch Transitions, enabling the State Machine to enter a specific state based on the evaluation of multiple conditions. This feature simplifies the design and maintenance of complex logic where a set of conditions must be checked to determine the next state.

Example of Choice Usage

In the State Machine diagram below, the transition begins at the Initial State and proceeds to the Evaluate State.

drawing-4-1737693957.png

When "Transition" (marked as 1 in the above figure) is triggered by a mouse click, the State Machine moves to the Choice element (orange-framed section in the figure). At this point, the transition branches based on the evaluated conditions:

The priority of an Exit Transition connected to a Choice element is the same as the normal Transition priority change procedure.

By utilizing Choice elements, multiple conditions can be clearly organized within the State Machine, making the branching structure easy to visualize. This makes it possible to design complex logic in a simple manner.

ViewState

ViewState is a specialized State used to control whether a specific View is displayed or hidden during the State Machine flow. It is linked to a corresponding View defined in the View Definition Editor.

There are two ways to created a ViewState:

  1. Dragging a View from Solution Explorer
    • Drag a View directly from the Solution Explorer and drop it onto the State Machine Editor diagram
    • A corresponding ViewState is created automatically.
  2. Using the State Machine Editor toolbar
    • Select the ViewState element from the toolbar and place it onto the diagram.
    • In the Properties panel, configure the ViewState's view.

When configuring a State Machine that switches from displaying one scenario to displaying another, the configuration effort is significantly reduced when using ViewStates instead of States and TransitionRequests

Please also see Jump To View Action. 


Revision #18
Created 2023-02-15 08:29:39 UTC by Tsuyoshi.Kato
Updated 2026-01-30 13:31:37 UTC by Elisabeth Zauner