Hello community,
I want to create a button in the UI that can be clicked using the Magic Leap controller. Here is what I did:
- I simply dragged the XR Rig package from the Magic Leap SDK package and checked that the references in the Game Controller are filled in the XR Controller (Action based). Here is the reference:
- Then, in the Hierarchy, I right-clicked -> XR -> UI Canvas.
- I placed a button inside the UI canvas and added a script for the click listener. This click listener prints a debug log when clicked.
When I run this app in the simulator, and I click on the UI button using raycasting through the controller, the color of the ray changes from red to white, but no logs are being printed.
I saw this approach in every tutorials, but not working with Magic Leap.
Other Working Approach:
Another approach I followed was to add the Grab Interactable component and a collider to the buttons. Now it listens to the click, but it also becomes movable, which is not intended. Please help me solve this problem.