Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using xbox controller with Holographic Remoting Player

Discussion in 'VR' started by Heaume, Nov 16, 2018.

  1. Heaume

    Heaume

    Joined:
    Jul 31, 2018
    Posts:
    5
    Hello,

    I'm trying to use my xbox one controller while debugging with the holographic (remote to device) play mode. Otherwise I will have to make a new build each time I want to test and it's not convenient. I tried pairing the controller with bluetooth on my pc while using play mode but it does not work, while it's working fine on the hololens (if I make a build of course).
     
  2. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Make sure to click into the game view of the editor to give focus to it, see if that gets you up and running. Also confirm Windows is seeing your controller input by hitting windows key and entering "Controller", it should open the "Game Controllers" dialog and make sure your controller is there and axes are updating when you do things on the controller
     
  3. Heaume

    Heaume

    Joined:
    Jul 31, 2018
    Posts:
    5
    Thank you for your answer Jason,

    I'm currently using the following asset for handling the controls inside the hololens: https://assetstore.unity.com/packag...ment/xbox-controller-input-for-hololens-70068
    but as noted in the description, it does not handle inputs in the Unity Editor. I tried using the MRTK tools : https://github.com/Microsoft/MixedRealityToolkit-Unity but I'm clueless as how to exploit the XboxControllerInputSource provided. I'm currently using the input manager for debugging purposes in the editor:
    01.JPG
    02.jpg

    I would prefer to learn to use the MRTK, but I can't really find any extensive documentation about it.
     
  4. Heaume

    Heaume

    Joined:
    Jul 31, 2018
    Posts:
    5
    [Update][Resolved]
    Ok so I found a way to do what I wanted for debugging:
    • I'm opening my project with Visual Studio (.sln file in the UWP directory of the Unity project)
    • I chose Release x86 and Device
    Capture1.JPG
    • I press F5 to start Debugging
    capture2.png
    > I can now read my debug.logs in the output console.

    Now that I can see the logs, I see that there's an error every update concerning the controller's input:

    Code (CSharp):
    1. ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    2. Parameter name: index
    3.    at System.Runtime.InteropServices.WindowsRuntime.IVectorViewToIReadOnlyListAdapter.Indexer_Get[T](Int32 index)
    4.    at HoloLensXboxController.ControllerInput.Update()
    5.    at ControllerInputExample.Update()
    6.    at ControllerInputExample.$Invoke18(Int64 instance, Int64* args)
    7.    at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
    8. (Filename: <Unknown> Line: 0)
    This is caused by the controller input update:
    (It's a script I modified from the asset I linked in my previous post: Xbox Controller Input for HoloLens)
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using HoloLensXboxController;
    4.  
    5. public class ControllerInputExample : MonoBehaviour
    6. {
    7.  
    8. private ControllerInput controllerInput;
    9.  
    10. void Start ()
    11. {
    12.         controllerInput = new ControllerInput(0, 0.19f);
    13. }
    14.  
    15. void Update ()
    16. {
    17.         controllerInput.Update();
    18. }
    19.  
    20. }
    21.  
     
    JasonCostanza likes this.