-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
If XRSDKDeviceManager attempts to create an instance of the base GenericXRSDKControllers class it will fail as the invocation of Activator.CreateInstance no longer passes the correct number of arguments.
This occurs because GenericXRSDKController's constructor now takes 5 arguments, but all of its base classes still take only 4.
Because all subclasses of XRSDKDeviceManager (e.g. OculusXRSDKDeviceManager, WindowsMixedRealityDeviceManager, etc.) pass back a subclass of GenericXRSDKController from their GetControllerType() function, this never occurs with the default MRTK setup.
But subclasses of XRSDKDeviceManager which do not override GetControllerType() will fail on the subsequent Activator.CreateInstance call in GetOrAddController()
To reproduce
Steps to reproduce the behavior:
- Create a subclass of XRSDKDeviceManager without overriding GetOrAddController or GetControllerType
- Set that subclass as an input provider in the profile's input system settings with a Supported Platform of 'Windows Universal' (or whatever platform you deploy to)
- Add right and a left hand 'Generic Unity' controllers to the Controller Definitions list in the Input profile's Controllers section
- Build to device and run
Expected behavior
The controllers are detected (either hands or VR controllers) and the default implementations for tracking and interactions in GenericXRSDKController are used.
Actual behaviour
The controllers are not detected due to a MissingMethodException thrown at the invocation to Activator.CreateInstance
To fix
Either:
- Change the Activator.CreateInstance call and the constructors in the subclasses or
- Switch on the controller type being created and call one overload or the other
Setup
- Unity Version 2020.3.16f1
- MRTK Version 2.7.2
Target platform (please complete the following information)
- HoloLens 2
- Oculus Quest 2
- Vive Focus