ARCore cannot detect a button hit inside the canvas
Well i have to create this augmented reality application that has a floating menu inside the main screen. I'm using the ARCore SDK from Google with Unity. Until now i have managed to create my menu and set up the ARCore camera so i can view the menu correctly while the background is rendered with the device's camera. The button therefore cannot be clicked, i have tried using RayCasting onto the button with a collider but that does not work either. I'm quite new to Unity game development, thank you.
The code that i tried is this, it works with game objects but not UI Elements.
//Code from Google's example
if (Input.touchCount< 1 || (touch = Input.GetTouch(0)).phase != TouchPhase.Began)
{
return;
}
//My Code
Debug.Log("Touched");
Ray ray = FirstPersonCamera.ScreenPointToRay(Input.GetTouch(0).position);
RaycastHit hitObject;
if(Physics.Raycast(ray,out hitObject, Mathf.Infinity))
{
Debug.Log(hitObject.transform.name);
Debug.Log(hitObject.collider.name);
return;
}
Having exactly the same issue, anyone?
They have working GUI menu in here (https://www.youtube.com/watch?v=qTSDPkPyPqs) but it's not working for me ... maybe different changed with new ARcore?