You can use Hide actions to hide components in the scene when a particular component is interacted with in a specific way.
Creating a Hide Action
Select the component to trigger the action. Go to the Actions tab in Inspector and click the button below the Actions list. Then select the Hide action from the pop-up menu.
You can now select the Event, Receiver, and other general settings for the action. For more information on general settings of actions, see Using Actions.
Using Hide Actions
Generally, Hide actions are used to take content out of the interface when it is no longer relevant for some reason. This helps emphasize specific content and keep users focused. It also helps keep the interface as a whole more neatly organized.
Note: Triggering a Hide action on a component that is already not visible has no further effect.
After being hidden by a Hide action, the component will remain hidden until being shown again by another action. If you need the component to later appear in your multi-touch scenario, make sure to create a way to show it again, for instance by a Show action.
In this example, a Hide action is used to hide two Media Player components when a third Media Player component is clicked. You can find this example project as part of the Screencast 2.0 project, which is also treated in the screencasts on the same page. Since the settings have already been made in the demo project, you can follow these steps to see how it was done.
To add the Hide action, first decide which asset is to trigger the action. To use the "Media Player 1-t" component as a trigger, proceed as follows.
- Start by clicking on "Media Player 1-t" in the Scene Manager. It's located under the "Layer Touch" layer.
- Click on the Actions tab of the Inspector
- Click on the button and select the Hide action.
Now that a Hide action has been assigned to "Media Player 1-t", some final adjustments are required.
- Start by choosing an event to trigger the action. In this case, use Clicked.
- Now choose a receiver for this action, in this case "Media Player 2-t".
- Since the remaining properties are not relevant for a Hide action, and since "Media Player 2-t" has no child components, the other properties can be left unchanged.
By now one Media Player component can be hidden, but it's required to hide two. To also hide the other one, create a second Hide action the same way as described and select "Media Player 3-t" as the receiver. Because both Hide actions have the same event selected, clicking on "Media Player 1-t" will hide both "Media Player 2-t" and "Media Player 3-t".