GUI buttons within an augmented GameObject AR Foundation
I am using the AR Foundation scene to augment a GameObject, using the script PlaceOnPlane to spawn a Prefab that consists of a 3D model and some GUI.
The Prefab augments fine when testing on an Android device, it moves to where I drag or tap.
The GUI consists of 2 different Canvases: one set to Scale with Screen Size, and the other is set to World Space.
The buttons in the former Canvas do function, but they make the model move.
The buttons in the latter don't work, only moving the model.
As this is a prefab, it doesn't have a Camera that I can assign in the Inspector for the World Space Canvas so I used this script on it to find the main camera in the scene (This is the AR Camera in the AR Session Origin)
public GameObject myCanvas;
public GameObject KAHolder;
void Start(){
GameObject canvas = Instantiate (myCanvas) as GameObject;
canvas.GetComponent<Canvas> ().worldCamera = Camera.main;
}
public void PlayVid(){
KAHolder.SetActive(true);
}
Can anyone help me with 1) Not having the model move when I tap the GUI buttons and 2) Get the World Space button to work?
Your answer
Follow this Question
Related Questions
UI penetration through objects. 1 Answer
Share button AR 0 Answers
Problem with creating button via script. 1 Answer
How to physics raycast through overlay UI? 1 Answer
Text in UI disappears when clicked on 0 Answers