Structuring Screen Transitions with Parent-Child View States
ThisIn pagethis guidespage, you through definingdefine NavigationView as a parent ViewComposite View, and creatinginside it, you build a configurationstructure that switches between NavigationMain_ViewNavigationMain (a Scene with IsView=true) and RouteDetailsView (a Composite View) as child View StatesStates. within it. HereWhat you willlearn learnhere is that, unlike the sibling relationship covered onin the previous page, a parent-child relationship is suited for "switching only a local statesstate while maintaining athe commonshared display." By keeping the map and shared buttons visible inside NavigationView while switching only between the normal display and the detail display,display while maintaining the map and shared buttons inside NavigationView, you willunderstand gain athe practical understandinguse of how to usethe parent-child structuresstructure in the View Tree. InYou addition,also yourevisit canthe reconfirmcomposition howthat tocombines combinea newlyComposite created ViewsView with Viewsa derivedScene fromthat existinghas scenes.IsView=true.
Creating CommonShared Scenes for Navigation
NavigationMap Scene
Create a new 2D scene and name it
NavigationMap.NavigationMap.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 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
Creating Transition Scenes for Navigation
NavigationMain Scene
Create a new 2D scene and name it
NavigationMain.NavigationMain.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 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 - Next,
Placeplace 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
Create a new 2D scene and name it
RouteDetailsContent.RouteDetailsContent.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 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
Creating Navigation-Related Views
Here, you will use both approaches:the case of creating a simple View from an existing sceneScene and the case of creating a new View that combines multiple components. UnderstandingThis when to use each approachdistinction is also important forwhen learning the parent-child structures.structure.
Creating Views: Using Existing Scenes
- Select each of the
fourfive scenes created in the previous steps andchooseCreate Viewfromselect thecontextIsViewmenucheckboxtoincreatethea View corresponding to each scene.SceneNamecategory of the Properties panel.

ViewNavigationMap
Creating athe New RouteDetailsView
- Create a new View and name it
RouteDetailsView.RouteDetailsView. - Double-click the created RouteDetailsView to open the View Definition Editor.
- Add the following elements to the left pane of the View Definition Editor:
RouteDetailsContent_ViewRouteDetailsContent
NavigationBack_ViewNavigationBack
RouteDetailsView is a screen state that groupsbundles the detail display bodyitself and the backreturn operation together.operation. By extracting a localizedlocal setgrouping oflike componentsthis as a compositeComposite View in this way,View, you can handlemake it moreeasier easilyto treat it as a child View State later.
Configuring NavigationView
SelectIn Solution Explorer, select the Solution folderin Solution Explorerandchooseselect Add > New Item from the context menu.- In the
AddNew Item dialog, select View and name itNavigationView.NavigationView. - Double-click the created NavigationView to open the View Definition Editor.
- Add the following elements to the left pane of the View Definition Editor:
Background_ViewBackgroundHeaderViewHeaderNavigationMap_ViewNavigationMapNavigationViewButtons_ViewNavigationViewButtons
Configuring MainViewTree
- Double-click MainViewTree to open the View Tree panel.
- Drop NavigationView into the empty area below MainView and DetailView to add it as a top-level View State.
- Drop
NavigationMain_ViewNavigationMain onto the body of the parent NavigationView to add it as a child View State. - Drop RouteDetailsView onto the body of the parent NavigationView to add it as a child View State.
Configuring Navigation-Related Transitions
Here, you will configure both athe transitiontransitions to a top-level sibling View StateStates and the switching betweenof child View States under the parent. This demonstratesshows that even with the same Jump To View behavior,takes theon meaningdifferent changesmeanings depending on whichthe relationship of the target View belongsyou jump to.
MainContent Scene
- Double-click the MainContent scene to open the Scene Editor.
Select OpenNavigationButton inIn the SceneTree.Tree, select OpenNavigationButton.- Drag and drop a Jump To View behavior onto
theAction in the Extra Scene Tree. - 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
NavigationBack Scene
NavigationViewButtons Scene
Verifying Behavior in the Player
The purpose of this verification is to observesee how the meaning of the parent-child relationship is reflected in the screen display. Pay attention to the factVerify that the commonshared display elementsportion areis maintained while only the child Statesstate switch.switches.
- Save the solution and launch the Player.
- Verify that MainView
appearsis displayed immediately after launch.
- Verify that MainView
PressClick the Open Navigation button.- Verify that the screen switches to NavigationView.
VerifyAt the same time, verify that Background and Header aredisplayed at the same time.displayed.AlsoIn addition, verify that Navigation Main, Navigation Map, the ShowDetailsDetail button, and the Home button are displayed.
PressClick the Show Details button.- Verify that the screen switches to Route Details.
VerifyAt the same time, verify that Background and Header aredisplayed at the same time.displayed.AlsoIn addition, verify that Navigation Map and the Home button are displayed.
PressClick the Back button.PressClick Home.- Verify that the screen returns to MainView.