Hey there
I’m new in developing C#/Unity and I have to make an app prototype for school with Unity (5.6.2.1f2) for HoloLens. I’ve completed the Gaze tutorial and this works well: holoacademy/holograms-210
So there’s a assigned object in GameObject “ObjectToTagAlong” and the code in line 28 instantiatedObjectToTagAlong.SetActive(true); works fine: When an object is deactivated in Unity, this function shows the assigned object when I click on the “main object”.
Now I have to not just do activate it, it also should be possible to hide it when clicked on the same “main object” or the assigned object itself → like a “toggle”. So I’ve tried instantiatedObjectToTagAlong.SetActive(false); which is not working to an object which has been set to visible in Unity before (the opposite procedure like the working one).
Can somebody explain me why SetActive(true) is working and SetActive(false) not? Or do you have a better solution to toggle game objects?