O'Reilly logo

Learn ARCore - Fundamentals of Google ARCore by Micheal Lanham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Scripting the buttons

The obvious next step is to get those buttons working. Of course, we need to add a little bit of scripting, shown as follows:

  1. Open the SceneController script we created earlier in your code editor. Just before the Update method, insert the following section of code:
private List<GameObject> m_sceneObjects = new List<GameObject>();private List<GameObject> m_scenePlanes = new List<GameObject>();private bool m_planeOnState;public void ClearScene(){  foreach(var obj in m_sceneObjects)  {    Destroy(obj);  }  m_sceneObjects.Clear();}public void Planes(){  m_planeOnState = !m_planeOnState;  //turn plane visibility on or off  foreach(var plane in m_scenePlanes)  {    plane.SetActive(m_planeOnState);  }}
  1. In this code, we first create some ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required