XRTK / com.xrtk.wmr

The Windows Mixed Reality platform components for the XRTK
https://github.com/XRTK/XRTK-Core
MIT License
22 stars 4 forks source link

If no Mixed Reality Camera system is setup, running on the UWP platform causes lots of errors #87

Closed SimonDarksideJ closed 3 years ago

SimonDarksideJ commented 4 years ago

XRTK - Mixed Reality Toolkit Bug Report

Describe the bug

If you run the XRTK on the UWP platform without a camera provider configured, the console is spammed with multiple errors related to Gaze / Input and controllers missing.

To Reproduce

  1. Clone XRTK dev
  2. Open Unity
  3. Switch to UWP platform
  4. Check the Camera settings, and if the "Windows Mixed Reality Camera Data Provider" exists, remove it
  5. Run the project
  6. Observe errors

Additional context

Logs reported by Unity when Camera not present

Object reference not set to an instance of an object
  at XRTK.Services.InputSystem.GazeProvider.InitializeGazePointer () [0x00026] in C:\LocalDevelopment\XRTK-Core\XRTK-Core\Packages\com.xrtk.core\Runtime\Services\InputSystem\GazeProvider.cs:408 
  at XRTK.Services.InputSystem.GazeProvider.get_GazePointer () [0x00000] in C:\LocalDevelopment\XRTK-Core\XRTK-Core\Packages\com.xrtk.core\Runtime\Services\InputSystem\GazeProvider.cs:98 
  at XRTK.Services.InputSystem.Sources.BaseGenericInputSource..ctor (System.String name, XRTK.Interfaces.InputSystem.IMixedRealityPointer[] pointers) [0x0001f] in C:\LocalDevelopment\XRTK-Core\XRTK-Core\Packages\com.xrtk.core\Runtime\Services\InputSystem\BaseGenericInputSource.cs:25 
  at XRTK.Services.InputSystem.MixedRealityInputSystem.RequestNewGenericInputSource (System.String name, XRTK.Interfaces.InputSystem.IMixedRealityPointer[] pointers) [0x00000] in C:\LocalDevelopment\XRTK-Core\XRTK-Core\Packages\com.xrtk.core\Runtime\Services\InputSystem\MixedRealityInputSystem.cs:523 
  at XRTK.Providers.Speech.WindowsSpeechDataProvider.Enable () [0x00022] in C:\LocalDevelopment\XRTK-Core\XRTK-Core\Packages\com.xrtk.core\Runtime\Providers\Speech\WindowsSpeechDataProvider.cs:78 
  at XRTK.Services.MixedRealityToolkit.EnableAllServices () [0x00095] in C:\LocalDevelopment\XRTK-Core\XRTK-Core\Packages\com.xrtk.core\Runtime\Services\MixedRealityToolkit.cs:1432 
UnityEngine.Debug:LogError(Object)
XRTK.Services.MixedRealityToolkit:EnableAllServices() (at Packages/com.xrtk.core/Runtime/Services/MixedRealityToolkit.cs:1436)
XRTK.Services.MixedRealityToolkit:OnEnable() (at Packages/com.xrtk.core/Runtime/Services/MixedRealityToolkit.cs:674)

NullReferenceException: Object reference not set to an instance of an object
XRTK.Services.InputSystem.GazeProvider.InitializeGazePointer () (at Packages/com.xrtk.core/Runtime/Services/InputSystem/GazeProvider.cs:408)
XRTK.Services.InputSystem.GazeProvider.get_GazePointer () (at Packages/com.xrtk.core/Runtime/Services/InputSystem/GazeProvider.cs:98)
XRTK.Services.InputSystem.GazeProvider+<Start>d__56.MoveNext () (at Packages/com.xrtk.core/Runtime/Services/InputSystem/GazeProvider.cs:297)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <7d97106330684add86d080ecf65bfe69>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <7d97106330684add86d080ecf65bfe69>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at C:/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:115)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

Failed to create WindowsMixedRealityMotionController!
System.NullReferenceException: Object reference not set to an instance of an object
  at XRTK.Providers.Controllers.BaseController.AssignControllerMappings (XRTK.Definitions.Controllers.MixedRealityInteractionMappingProfile[] interactionMappingProfiles) [0x00030] in C:\LocalDevelopment\XRTK-Core\XRTK-Core\Packages\com.xrtk.core\Runtime\Providers\Controllers\BaseController.cs:167 
  at XRTK.Providers.Controllers.BaseController..ctor (XRTK.Interfaces.Providers.Controllers.IMixedRealityControllerDataProvider controllerDataProvider, XRTK.Definitions.Devices.TrackingState trackingState, XRTK.Definitions.Utilities.Handedness controllerHandedness, XRTK.Definitions.Controllers.MixedRealityControllerMappingProfile controllerMappingProfile) [0x000cd] in C:\LocalDevelopment\XRTK-Core\XRTK-Core\Packages\com.xrtk.core\Runtime\Providers\Controllers\BaseController.cs:63 
  at XRTK.WindowsMixedReality.Providers.InputSystem.Controllers.WindowsMixedRealityMotionController..ctor (XRTK.Interfaces.Providers.Controllers.IMixedRealityControllerDataProvider controllerDataProvider, XRTK.Definitions.Devices.TrackingState trackingState, XRTK.Definitions.Utilities.Handedness controllerHandedness, XRTK.Definitions.Controllers.MixedRealityControllerMappingProfile controllerMappingProfile) [0x0006e] in C:\LocalDevelopment\XRTK-Core\XRTK-Core\Packages\com.xrtk.wmr\Runtime\Providers\InputSystem\Controllers\WindowsMixedRealityMotionController.cs:30 
  at XRTK.WindowsMixedReality.Providers.InputSystem.Controllers.WindowsMixedRealityControllerDataProvider.GetController (UnityEngine.XR.WSA.Input.InteractionSource interactionSource, System.Boolean addController) [0x0007a] in C:\LocalDevelopment\XRTK-Core\XRTK-Core\Packages\com.xrtk.wmr\Runtime\Providers\InputSystem\Controllers\WindowsMixedRealityControllerDataProvider.cs:425 
UnityEngine.Debug:LogError(Object)
XRTK.WindowsMixedReality.Providers.InputSystem.Controllers.WindowsMixedRealityControllerDataProvider:GetController(InteractionSource, Boolean) (at Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityControllerDataProvider.cs:429)
XRTK.WindowsMixedReality.Providers.InputSystem.Controllers.WindowsMixedRealityControllerDataProvider:Update() (at Packages/com.xrtk.wmr/Runtime/Providers/InputSystem/Controllers/WindowsMixedRealityControllerDataProvider.cs:327)
XRTK.Services.MixedRealityToolkit:UpdateAllServices() (at Packages/com.xrtk.core/Runtime/Services/MixedRealityToolkit.cs:1464)
XRTK.Services.MixedRealityToolkit:Update() (at Packages/com.xrtk.core/Runtime/Services/MixedRealityToolkit.cs:682)
StephenHodgson commented 4 years ago

What is the expected result? Silently fail and fallback to the default camera data provider that might not work?

SimonDarksideJ commented 4 years ago

If a camera is required, then we should see a single error stating the configuration is invalid and needs a camera. If a camera configuration isn't mandatory, then a default would be nice, but still probably better to fail.

But we should never see a wrath of errors for a single identifiable problem.

StephenHodgson commented 4 years ago

I agree, let's try to do a validation in the editor to ensure that the developer is properly notified.

StephenHodgson commented 3 years ago

@SimonDarksideJ is this still an issue?

SimonDarksideJ commented 3 years ago

I'll retest with the button issue asap

SimonDarksideJ commented 3 years ago

Tested on Core 171 / WMR 27 and working fine