From the course: Unity: AR Visualization 02 Basic Interactivity

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Adding the hide functionality

Adding the hide functionality - Unity Tutorial

From the course: Unity: AR Visualization 02 Basic Interactivity

Start my 1-month free trial

Adding the hide functionality

- [Instructor] Right, we have the button, let's make it work. To do that we're going to work backwards from the desired functionality. So when we press this button, we want the ARPart to hide. We're going to have to go through the ARManager to do this. So let's start with the ARPart, the thing we want to hide. Let's go and navigate to ARPart, double click to open in your code editor. Alright, we don't have much here, we just have registration with the ARPartManager. So what we're going to do is add in two methods called hide and show. These are going to be public methods, so public void show. And like with many things in Unity like this, we are going to hide and show the game object by setting it active. So let's go get the GameObject.SetActive, and for showing, the SetActive needs to be true. Now for hiding it's going to be the same thing, except for SetActive is going to be set to false. So we're going to copy our show,…

Contents