Skip to main content

Structuring Screen Transitions with Parent-Child View States

This page guides you through defining NavigationView as a parent View and creating a configuration that switches between NavigationMain_View and RouteDetailsView as child View States within it. Here you will learn that, unlike the sibling relationship covered on the previous page, a parent-child relationship is suited for switching only local states while maintaining a common display. By keeping the map and shared buttons visible inside NavigationView while switching only between the normal display and the detail display, you will gain a practical understanding of how to use parent-child structures in the View Tree. In addition, you can reconfirm how to combine newly created Views with Views derived from existing scenes.

Creating Common Scenes for Navigation

First, prepare the elements that you want to remain visible whenever NavigationView is active. Here, you will treat the map display and the Home button as common elements and incorporate them into the parent View definition later.

NavigationMap Scene

  1. Create a new 2D scene and name it NavigationMap.

  2. Select the camera in the Scene Tree and configure the following properties in the Properties panel:

    Property Category Item Value
    Camera Sequence Number 1
      Clear Color Buffer False
      Enable Swapping False
  3. Place a 2D Text Node from the Toolbox onto the Scene Tree of the NavigationMap scene.

    Property Category Item Value
    Transform Position X 250
      Position Y 200
    2D Text Node Text Navigation Map

NavigationViewButtons Scene

  1. Create a new 2D scene and name it NavigationViewButtons.

  2. Select the camera in the Scene Tree and configure the following properties in the Properties panel:

    Property Category Item Value
    Camera Sequence Number 2
      Clear Color Buffer False
      Enable Swapping False
  3. Place a TextButton control onto the Scene Tree of the NavigationViewButtons scene and configure the following properties:

    Property Category Item Value
    General Name JumpToHomeViewButton
    Transform Position X 350
      Position Y 300
    Control Text Home

NavigationMap and NavigationViewButtons are elements that should always remain visible while NavigationView is active. Therefore, you will incorporate them into the parent View definition later.

Creating Transition Scenes for Navigation

Next, prepare the elements to switch within NavigationView. Here, you will create separate scenes for the normal display and the route detail display so that they can be used as child States of the parent View.

NavigationMain Scene

  1. Create a new 2D scene and name it NavigationMain.

  2. Select the camera in the Scene Tree and configure the following properties in the Properties panel:

    Property Category Item Value
    Camera Sequence Number 2
      Clear Color Buffer False
      Enable Swapping False
  3. Place a 2D Text Node from the Toolbox onto the Scene Tree of the NavigationMain scene.

    Property Category Item Value
    Transform Position X 50
      Position Y 200
    2D Text Node Text Navigation Main
  4. Place a TextButton control and configure the following properties:

    Property Category Item Value
    General Name ShowDetailsButton
    Transform Position X 50
      Position Y 300
    Control Text Show Details

RouteDetailsContent Scene

  1. Create a new 2D scene and name it RouteDetailsContent.

  2. Select the camera in the Scene Tree and configure the following properties in the Properties panel:

    Property Category Item Value
    Camera Sequence Number 2
      Clear Color Buffer False
      Enable Swapping False
  3. Place a 2D Text Node from the Toolbox onto the Scene Tree of the RouteDetailsContent scene.

    Property Category Item Value
    Transform Position X 450
      Position Y 200
    2D Text Node Text Route Details

NavigationBack Scene

  1. Create a new 2D scene and name it NavigationBack.

  2. Select the camera in the Scene Tree and configure the following properties in the Properties panel:

    Property Category Item Value
    Camera Sequence Number 2
      Clear Color Buffer False
      Enable Swapping False
  3. Place a TextButton control onto the Scene Tree of the NavigationBack scene and configure the following properties:

    Property Category Item Value
    General Name BackToNavigationMainButton
    Transform Position X 50
      Position Y 300
    Control Text Back

NavigationMain represents the normal display, while RouteDetailsContent and NavigationBack are components for the detail display. These are not common display elements; instead, they serve as the switching targets within NavigationView.

Creating Navigation-Related Views

Here, you will use both approaches: creating a simple View from an existing scene and creating a new View that combines multiple components. Understanding when to use each approach is also important for learning parent-child structures.

Creating Views: Using Existing Scenes

  1. Select each of the four scenes created in the previous steps and choose Create View from the context menu to create a View corresponding to each scene.
    Scene Name View Name (auto-assigned)
    NavigationMap NavigationMap\_View
    NavigationViewButtons NavigationViewButtons\_View
    NavigationMain NavigationMain\_View
    RouteDetailsContent RouteDetailsContent\_View
    NavigationBack NavigationBack\_View

Creating a New RouteDetailsView

  1. Create a new View and name it RouteDetailsView.

  2. Double-click the created RouteDetailsView to open the View Definition Editor.

  3. Add the following elements to the left pane of the View Definition Editor:
    • RouteDetailsContent_View

    • NavigationBack_View

RouteDetailsView is a screen state that groups the detail display body and the back operation together. By extracting a localized set of components as a composite View in this way, you can handle it more easily as a child View State later.

Configuring NavigationView

Here, you will group only the elements that should always remain visible while in Navigation into the parent View. It is important that the parent View contains only the common display elements and does not include the elements that you want to switch.

  1. Select the Solution folder in Solution Explorer and choose Add > New Item from the context menu.

  2. In the Add New Item dialog, select View and name it NavigationView.

  3. Double-click the created NavigationView to open the View Definition Editor.

  4. Add the following elements to the left pane of the View Definition Editor:
    • Background_View
    • HeaderView
    • NavigationMap_View
    • NavigationViewButtons_View

The definition of NavigationView does not include NavigationMain_View or RouteDetailsView. You will add these later as child View States on the View Tree so that they become switching targets under the parent. This separation clarifies the roles of the common display and the local switching.

Configuring MainViewTree

Here, you will add NavigationView as a top-level sibling View and attach child View States beneath it. This allows you to experience a two-layer structure: a sibling relationship at the top level and a parent-child relationship inside Navigation.

  1. Double-click MainViewTree to open the View Tree panel.

  2. Drop NavigationView into the empty area below MainView and DetailView to add it as a top-level View State.

  3. Drop NavigationMain_View onto the body of the parent NavigationView to add it as a child View State.

  4. Drop RouteDetailsView onto the body of the parent NavigationView to add it as a child View State.

By dropping elements onto the body of the parent, the child States are treated as internal states of NavigationView while it is active. This is the essential difference between a parent-child relationship and a sibling relationship.

Configuring Navigation-Related Transitions

Here, you will configure both a transition to a top-level sibling View State and switching between child View States under the parent. This demonstrates that even with the same Jump To View behavior, the meaning changes depending on which relationship the target View belongs to.

MainContent Scene

  1. Double-click the MainContent scene to open the Scene Editor.

  2. Select OpenNavigationButton in the Scene Tree.

  3. Drag and drop a Jump To View behavior onto the Action in the Extra Scene Tree.

  4. Select the added Jump To View behavior and configure the following properties in the Properties panel:
    Property Category Item Value
    General Name JumpToNavigation
    Asset View NavigationView

NavigationMain Scene

  1. Double-click the NavigationMain scene to open the Scene Editor.

  2. Select ShowDetailsButton in the Scene Tree.

  3. Drag and drop a Jump To View behavior onto the Action in the Extra Scene Tree.

  4. Select the added Jump To View behavior and configure the following properties in the Properties panel:
    Property Category Item Value
    General Name JumpToRouteDetail
    Asset View RouteDetailsView

NavigationBack Scene

  1. Double-click the NavigationBack scene to open the Scene Editor.

  2. Select BackToNavigationMainButton in the Scene Tree.

  3. Drag and drop a Jump To View behavior onto the Action in the Extra Scene Tree.

  4. Select the added Jump To View behavior and configure the following properties in the Properties panel:
    Property Category Item Value
    General Name JumpToNavigationMain
    Asset View NavigationMain\_View

NavigationViewButtons Scene

  1. Double-click the NavigationViewButtons scene to open the Scene Editor.

  2. Select JumpToHomeViewButton in the Scene Tree.

  3. Drag and drop a Jump To View behavior onto the Action in the Extra Scene Tree.

  4. Select the added Jump To View behavior and configure the following properties in the Properties panel:
    Property Category Item Value
    General Name JumpToMainView
    Asset View MainView

The key point here is that within NavigationView, NavigationMain_View and RouteDetailsView switch between each other as child View States, whereas the Home button exits Navigation entirely and returns to MainView, which is a top-level sibling View State.

Verifying Behavior in the Player

The purpose of this verification is to observe how the parent-child relationship is reflected in the screen display. Pay attention to the fact that the common display elements are maintained while only the child States switch.

  1. Save the solution and launch the Player.
    • Verify that MainView appears immediately after launch.

  2. Press the Open Navigation button.
    • Verify that the screen switches to NavigationView.
    • Verify that Background and Header are displayed at the same time.
    • Also verify that Navigation Main, Navigation Map, the Show Details button, and the Home button are displayed.

  3. Press the Show Details button.
    • Verify that the screen switches to Route Details.
    • Verify that Background and Header are displayed at the same time.
    • Also verify that Navigation Map and the Home button are displayed.

  4. Press the Back button.
    • Verify that the screen returns to Navigation Main.

  5. Press Home.
    • Verify that the screen returns to MainView.

On this page, you created a structure in which NavigationView serves as the parent View State and child View States switch within it. Through this exercise, you confirmed in practice that sibling relationships are suited for exclusive switching of entire screens, while parent-child relationships are suited for switching only local states while keeping common display elements visible. In the next page, you will add conditional automatic transitions to DetailView using the Action Chain Editor and the Condition Editor.