Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

UI buttons are not working on device build.

Discussion in 'Android' started by mondokbence, Apr 20, 2021.

  1. mondokbence

    mondokbence

    Joined:
    Feb 17, 2021
    Posts:
    1
    I am working on an AR project, where i am placing down a car on the scanned plane. The placing is happening after i tap on the screen, and that is working fine. I am checking if the tap is not happening on any of the UI buttons (with EventSyste.current.IsPointerOverGameObject()), and that is working as well.

    I want to control the car with UI buttons, wich are working in unity, i can click on them, and the car will move as intended based on what i pressed. However when i build the app and i click on the UI buttons on my phone, nothing is happening. I logged out some things, and for some reason on mobile the OnAccelerate, OnTurnLeft, etc... functions are not called (the log is made inside them), meanwhile in Unity they are being logged as shown in the picture below:
    upload_2021-4-20_20-12-46.png
    I am using the "new" input system, and the massage sending behavior based on the arrow keys: upload_2021-4-20_20-19-57.png
    The input actions:
    upload_2021-4-20_20-16-41.png
    upload_2021-4-20_20-18-47.png
    The UI buttons are all On-Screen buttons with the control path set as in the input actions asset.

    My EventSystem:
    upload_2021-4-20_20-20-25.png
    I have tried changing the pointer behavior.

    What could be the problem here?
    Thanks in advance!
     
  2. VCUMCL

    VCUMCL

    Joined:
    Jun 5, 2017
    Posts:
    24
    I'm going through something very similar, as I'm translating a VR game to the Oculus Quest 2. I have a UI button that is working within the Unity Editor, but once I build it to the headset, the button does not work, and I'm sure it is because certain functions are not being called. I am in the process of figuring out what exactly is not being called and why.