0
votes

I am trying to make an app in AR in which I have some 3d objects placed on same plane ground. I want to make those objects visible when the Gui button is clicked of that specific object and hide the others I have used the following code but it's not working. Whenever I touch the screen all the objects becomes visible overlapping each other, when they should not appear if I touch but click the button.

public GameObject 3DModel_One;

public GameObject 3DModel_Two;



public void ButtonClicked(){

    3DModel_One.SetActive(true);
    3DModel_Two.SetActive(false);

}    
1
Have you solved?Kerberos

1 Answers

0
votes

Are your objects children of your ground plane? Also are you duplicating the stage when clicked. Those two could be your problem. I have implemented it using this code and it is working :

 if (Input.GetKey(KeyCode.Mouse0))
        target.SetActive(false);
    if (Input.GetKey(KeyCode.Mouse1))
        target.SetActive(true);

but my target object is not a child of the ground plane and i am not duplicating the stage.