Using ArKit with UI

HI!

I’m trying to figure out how to use ArKit with UI buttons or other elements. So I want to use the basic positioning functionality of ArKit, but also for example to have a camera icon which takes a screenshot. Now when I’m clicking the button, it also repositions the ar content. I can disable/enable the script, but this needs an extra step for the user and that is not really what I want, or anybody wants.

So how to block “Camera.main.ScreenToViewportPoint(touch.position)” with UI elements…?

I’ve been scratching my head for quite some time with this now and I would really appreciate help with this one.!

Thank you!

@RoguePrimitive

You need to add a line in the Update function of the script that re-positions your AR object (UnityARHitTestExample) and add the condition (if not hitting a UI component).

if(EventSystem.current.IsPointerOverGameObject(0) == false){
// re positioning code here
}