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. Dismiss Notice

Question MixedReality Input MotionControllerWatcher Error

Discussion in 'VR' started by GebhardtXR, Jun 1, 2021.

  1. GebhardtXR


    Jan 10, 2020
    I am trying to set up a project to get input from the Motion Controllers' A/B and X/Y buttons, following the documentation for HP Reverb G2 Controllers in Unity.

    Right after adding the first part of code from the documentation to MotionControllerStateCache.cs, the console shows the following:

    FileNotFoundException: Failed to load "vcruntime140_app.dll". Please ensure that "Microsoft Visual C++ 2015-2019 Redistributable" is installed.
    WinRT.ActivationFactory`1[T]..ctor () (at <008cf01b9d2f4ab4b576cf1cad2f8766>:0)
    System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) (at <9577ac7a62ef43179789031239ba8798>:0)
    System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) (at <9577ac7a62ef43179789031239ba8798>:0)
    System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) (at <9577ac7a62ef43179789031239ba8798>:0)
    System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) (at <9577ac7a62ef43179789031239ba8798>:0)
    System.Activator.CreateInstance[T] () (at <9577ac7a62ef43179789031239ba8798>:0)
    WinRT.WeakLazy`1+<>c[T].<.ctor>b__2_0 () (at <008cf01b9d2f4ab4b576cf1cad2f8766>:0)
    WinRT.WeakLazy`1[T].get_Value () (at <008cf01b9d2f4ab4b576cf1cad2f8766>:0)
    WinRT.ActivationFactory`1[T].ActivateInstance () (at <008cf01b9d2f4ab4b576cf1cad2f8766>:0)
    Microsoft.MixedReality.Input.MotionControllerWatcher..ctor () (at <008cf01b9d2f4ab4b576cf1cad2f8766>:0)
    MotionControllerStateCache.Start () (at Assets/Scripts/MixedRealityInput/MotionControllerStateCache.cs:54)

    MotionControllerStateCache.cs, line 54 holds the following code:
    _watcher = new MotionControllerWatcher();

    Microsoft Visual C++ 2015-2019 Redistributable is installed.

    Any help is highly appreciated.

    UPDATE: Installed the latest Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 (both x84 and x64), still the same error.

    Error first encountered in Unity 2019.4. Also tested with Unity 2020.3.
    Last edited: Jun 2, 2021
  2. yl-msft


    Microsoft Employee

    Jul 24, 2020
    I'm not sure how to solve the specific error you are hitting. But suggest you to consider OpenXR plugin, which supports ReverbG2 natively without adding additional libraries. You can follow instructions here to setup your Unity project with OpenXR plugin, and setup ReverbG2 controller profile in OpenXR settings page.
    Using the Mixed Reality OpenXR Plugin - Mixed Reality | Microsoft Docs
    GebhardtXR likes this.
  3. GebhardtXR


    Jan 10, 2020
    Thank you!
  4. akatukigyou


    Jul 18, 2017
    I'm getting the same error.
    ・Unity 2020.3.28f1
    ・Mixed Reality Inpu 0.9.2006

    I'm also having trouble because I can't use OpenXR due to the project side.

    How to reproduce the error
    public MotionControllerWatcher _watcher;
    public void Start()
    _watcher = new MotionControllerWatcher();
    nijingtech_DEV likes this.