- Home /
Change 3D Object by pressing Gui Button
i,m work with unity 3d and vuforia to make an augmented reality, my question is, how to make 3d model change when gui button pressed exemple i have a two 3D model as a child called object1 and object2 on ImageTarget(parent). now i wanna make two Gui button "button1" and "button2" . and if i hit the "button1" 3d model "objet1" show up and if i hit the "button2" 3d model "objet2" show up, i use a C# script any one here can help me?
Comment
what have you tried so far, have you got any code we can help you with?
Answer by aman_jha · Sep 08, 2014 at 04:35 PM
Make two functions and make two references for the two objects, like so:
public class AwesomeClass () {
public GameObject Object1;
public GameObject Object2;
void ButtonOneClicked () {
Object1.SetActive(true);
Object2.SetActive(false);
}
void ButtonTwoClicked () {
Object1.SetActive(false);
Object2.SetActive(true);
}
}