Wiring the menu buttons
When the user presses a main menu button to add an object to the scene, the button will tell PlaceObjectMode
which prefab is to be instantiated. Then PlaceObject mode is enabled, which prompts the user to tap to place the object and handles the user input action. Let's set up the menu buttons now using the following steps:
- Unfold the Main Menu game object in the Hierarchy by navigating to UI Canvas / Main UI / Main Menu and select the Cube Button object.
- In its Inspector, on the Button component, in its OnClick section, press the + button in the bottom right to add an event action.
- From the Hierarchy, drag the PlaceObject Mode object onto the OnClick Object slot.
- In the Function selection list, choose PlaceObject Mode | SetPlacedPrefab.
- In the Project window, locate a cube model prefab to use. For example, navigate to your
Assets/ARF-samples/Prefabs/
folder and drag the AR Placed Cube prefab into the Game Object slot for this click...