Pass information between scenes
There are many ways to pass information (e.g. values, user selection) from one scene to another in a running experience. In this article we are going to review 3 different ways which should fit all your needs.
All screen shots in this article come from the sample experience here. Feel free to try things out yourself.
Binding enables you as an experience designer to share trigger, action and property values with other triggers, actions and properties.
To create a binding, click the orange icon that appears to the right of any property, trigger parameter or action parameter over which you hover your mouse. Doing so implies you want this particular value to come from some external source. The binding panel opens, enabling you to select the source item and value. This source could be in any scene of the experience.
In the snapshot below, the value of the Text asset in Scene 2 comes from the value of the Text Input control found on Scene 1. (Click the image to enlarge it.)
Before navigating to another scene, you can call an action of any asset located in the destination scene if two conditions are held true
- the asset must be visible
- the destination scene's property Reset all asset properties must be turned off. If turned on, the value passed to the action would be overridden by a default value when entering the scene.
In the example below, we want a click on the OK button in the scene "TA Space 1" to cause the text value of a Text Input asset in the same scene to appear in a Text asset found in the scene "TA Space 2". The trigger/action pairing would be
- WHEN OK button is pressed and released THEN in Scene 2, call the Set Text action for the Text asset with the Set Text parameter bound to the Text Input asset in Scene 1. See image below; click to enlarge.
All Interface Assets (IA) can be reached from anywhere within an experience. As a result, IA properties act as global variables.
A special case is the Global Variable interface asset that exists explicitly for the purpose of holding a value across scenes.
With the use of a global variable:
- in Scene 1: use triggers and actions to store the value in this global variable
- in Scene 2: bind an asset to the same global variable to extract its value
Of course, your IA could be much more functional, implementing business logic that can process information.
In the image below, the value of a Text asset comes - via binding - from a Global Variable interface asset. Click the image enlarge.