cancel
Showing results for 
Search instead for 
Did you mean: 

UI button triggers not functional in build, but work as intended in editor

VCUMotorControl
Level 2

I am currently working to translate a VR game to the Oculus Quest 2 from a PC standalone version. In this game, I have created a VR menu with UI buttons that include box colliders with triggers active. These triggers have a script attached that when touched by the player, it will simulate the button being clicked.

 

private void OnTriggerEnter(Collider other)
        {
            if (other.gameObject.tag == "VRController" || other.gameObject.tag == "LeftHand" || other.gameObject.tag == "RightHand")
            {
                this.GetComponent<Button>().onClick.Invoke();
            }
        }

 

This works as intended in the Unity Editor, however, when I build the game, none of the triggers work as they should. I am unsure what the reason could be.

1 REPLY 1

VCUMotorControl
Level 2

So I decided to abandon the box colliders for the menu items and implemented the OVR Laser Pointer that is included in the Oculus Integration package. This allows me to access each menu item without needing to put colliders on them. The main issue I am having is with the Start Level button on this menu screen.

 

Screenshot 2022-09-06 140013.jpg

 

The Start Level button works as intended in the editor, however it does not function in the build version. Somehow, every other button functions as it should, which is baffling.