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

InputDevices.GetDevices - Why does it return void?

Discussion in 'AR/VR (XR) Discussion' started by ghostravenstorm, Jun 26, 2020.

  1. ghostravenstorm

    ghostravenstorm

    Joined:
    Oct 18, 2015
    Posts:
    88
    Why does `InputDevices.GetDevices` return void?
    That's not what I expect a function with the word "get" in the name to do.

    Why doesn't it return a List<T> instead of having to provide one as an argument posix style?

    https://docs.unity3d.com/ScriptReference/XR.InputDevices.GetDevices.html

    I just want to get a single device at a known location in the list in a single-line statement without having to hold onto this list I have to make myself just to fulfill the function's requirements.

    `thisXrDevice = InputDevices.GetDevices()[0];`