Modifying the InstructionsController

The InstructionsController will handle the AR and anchor modes for the app. Now we'll edit the InstructionsController script (component of Game Controller in the scene). Open the script for editing and change it as follows:

File: InstructionsController.cs

At the top of the class, add the following public and private variables:

    public GameObject standardContent;     private bool arMode;     public GameObject anchorButton;     public GameObject arPrompt;     private bool anchorMode;

Add the following methods to toggle the AR mode:

    public void ToggleAr() {         arMode = !arMode;         if (arMode) {             TurnOnArMode();         } else {             TurnOffArMode();         }     }     void TurnOnArMode() {         standardContent.SetActive(false);         TurnOffAnchorMode();     } void TurnOffArMode() ...

Get Augmented Reality for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.