Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question Can't Detect Input Source While Using XR Device Simulator

Discussion in 'XR Interaction Toolkit and Input' started by murtcnnbilgic, May 14, 2022.

  1. murtcnnbilgic

    murtcnnbilgic

    Joined:
    Jun 29, 2019
    Posts:
    21
    Hi. I am currently developing a simple app for an hackaton and I currently don't have access to a VR device. Therefore, I tried using XR Device Simulator which works. I can look around and move the right hand, left hand, the head etc. with using my mouse and keyboard. However, when I try to detect for example if I am pressing the trigger button wih my right hand, I can't. Here is the code:
    Code (CSharp):
    1. void Update()
    2.     {     UnityEngine.XR.Interaction.Toolkit.InputHelpers.IsPressed(InputDevices.GetDeviceAtXRNode(input_source), input_button, out bool isPressed, input_treshold);
    3. }
    From other thest lines I realised that "UnityEngine.XR.InputDevices.GetDevices" returns null which I think means my mouse and keyboard doesn't count as a "XR Input Device". How can I reach them?

    Thank you.
     
    ykarp likes this.