Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

UI Buttons on AR

Discussion in 'AR/VR (XR) Discussion' started by clebertavares, Oct 3, 2019.

  1. clebertavares

    clebertavares

    Joined:
    Jan 2, 2012
    Posts:
    55
    Hi,

    I´m using Unity 2019.3.0b4 with ARFoundation Preview 3.0.0, with URP settings in AR.

    My UI Buttons are working, I can click on them and make things, but, in Update code to control AR things like create objects and mark positions, I have a code like that at the very beggining:

    if (EventSystem.current.IsPointerOverGameObject()) return;

    This usually should work, but... its not. I click on my UI buttons and it recognizes like a click on the AR scene planes...

    What should be wrong?

    Thanks.
     
  2. Andrew_Zim

    Andrew_Zim

    Joined:
    Aug 30, 2017
    Posts:
    20
    I have some issues with unity UI too.
    I am using world UI on the object, which is placed on the ar plane.
    I am using ArSessionOrigin.MakeContentAppearAt method to instantiate the object, also I am scaling ARSessionOrigin to scale the object. But when I click on UI - it looks like I miss the button. When I tap on the the button, some times it works correctly, but some times it looks like raycast misses - and button interacting when I tap from some side of it, not on the center. You can see in the picture, red color - is "real" button object, which is invisible and larger then visible button - is the white point. All positions are in zero, so there shifts in UI objects. It works super good in editor, but in AR, I have such a problem. Each Button have its own canvas buttons capture.PNG
    Unity 2019.2.3.f1
    AR Foundation 2.0.2
    ArKit XR Plugin 2.0.1

    Ipad PRO with iOs 12.4.1
    @tdmowrer can You help ?
    Thanks
     
    Last edited: Oct 3, 2019
    clebertavares likes this.
  3. clebertavares

    clebertavares

    Joined:
    Jan 2, 2012
    Posts:
    55
    For now I am recognizing the Y coordinate of the screen click, and ignoring anything beyond certain value... but this is a workaround...
     
  4. Andrew_Zim

    Andrew_Zim

    Joined:
    Aug 30, 2017
    Posts:
    20
    [SOVED] I just removed postprocessing (color grading) from the scene.
     
    JustZht and clebertavares like this.
  5. clebertavares

    clebertavares

    Joined:
    Jan 2, 2012
    Posts:
    55
    Gonna try it
     
  6. laharigundu

    laharigundu

    Joined:
    Mar 8, 2022
    Posts:
    1
    Hello,
    I am using ARPlacementInteractable to place points on the screen when user taps on the screen.
    I created one button so that it would stop to place points after clicking it.
    But now I am facing issue because of this UI button. When I click on the button , point is getting created. I want to stop this. How can I achieve that. I think the problem lies in UI button.
    Anyone have any solution for this. Please do help :)