新建了一个新场景,发现丢失手部,不解,研究后发现hololens2的unity的后台日志报错:

NullReferenceException: Object reference not set to an instance of an object.
at MixedReality.Toolkit.Input.OpenXRHandsSubsystem+OpenXRHandContainer.TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, MixedReality.Toolkit.HandJointPose& pose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.HandsProvider`1[T].TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, UnityEngine.XR.XRNode handNode, MixedReality.Toolkit.HandJointPose& jointPose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Subsystems.HandsSubsystem.TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, UnityEngine.XR.XRNode hand, MixedReality.Toolkit.HandJointPose& jointPose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.MRTKHandsAggregatorSubsystem+AggregateHandContainer.TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, MixedReality.Toolkit.HandJointPose& pose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.MRTKHandsAggregatorSubsystem+MRTKAggregator.TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, UnityEngine.XR.XRNode handNode, MixedReality.Toolkit.HandJointPose& jointPose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.MRTKHandsAggregatorSubsystem+MRTKAggregator.TryGetPinchProgress (UnityEngine.XR.XRNode handNode, System.Boolean& isReadyToPinch, System.Boolean& isPinching, System.Single& pinchAmount) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Subsystems.HandsAggregatorSubsystem.TryGetPinchProgress (UnityEngine.XR.XRNode hand, System.Boolean& isReadyToPinch, System.Boolean& isPinching, System.Single& pinchAmount) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.ArticulatedHandController.UpdateInput (UnityEngine.XR.Interaction.Toolkit.XRControllerState controllerState) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.Interaction.Toolkit.XRBaseController.UpdateController () [0x00000] in <00000000000000000000000000000000>:0

NullReferenceException: Object reference not set to an instance of an object.
at MixedReality.Toolkit.PlayspaceUtilities.TransformPose (UnityEngine.Pose pose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.InputActionPoseSource.TryGetPose (UnityEngine.Pose& pose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.FallbackCompositePoseSource.TryGetPose (UnityEngine.Pose& pose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.MRTKRayInteractor.Update () [0x00000] in <00000000000000000000000000000000>:0

NullReferenceException: Object reference not set to an instance of an object.
at MixedReality.Toolkit.Input.OpenXRHandsSubsystem+OpenXRHandContainer.TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, MixedReality.Toolkit.HandJointPose& pose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.HandsProvider`1[T].TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, UnityEngine.XR.XRNode handNode, MixedReality.Toolkit.HandJointPose& jointPose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Subsystems.HandsSubsystem.TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, UnityEngine.XR.XRNode hand, MixedReality.Toolkit.HandJointPose& jointPose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.MRTKHandsAggregatorSubsystem+AggregateHandContainer.TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, MixedReality.Toolkit.HandJointPose& pose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.MRTKHandsAggregatorSubsystem+MRTKAggregator.TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, UnityEngine.XR.XRNode handNode, MixedReality.Toolkit.HandJointPose& jointPose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Subsystems.HandsAggregatorSubsystem.TryGetJoint (MixedReality.Toolkit.TrackedHandJoint joint, UnityEngine.XR.XRNode hand, MixedReality.Toolkit.HandJointPose& jointPose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.HandJointPoseSource.TryGetPose (UnityEngine.Pose& pose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.FallbackCompositePoseSource.TryGetPose (UnityEngine.Pose& pose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.PokeInteractor.TryGetPokePose (UnityEngine.Pose& pose) [0x00000] in <00000000000000000000000000000000>:0
at MixedReality.Toolkit.Input.PokeInteractor.ProcessInteractor (UnityEngine.XR.Interaction.Toolkit.XRInteractionUpdateOrder+UpdatePhase updatePhase) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.Interaction.Toolkit.XRInteractionManager.ProcessInteractors (UnityEngine.XR.Interaction.Toolkit.XRInteractionUpdateOrder+UpdatePhase updatePhase) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.XR.Interaction.Toolkit.XRInteractionManager.Update () [0x00000] in <00000000000000000000000000000000>:0

解决办法1:由于是全新的场景,里面除了要加入MRTK XR Rig/MRTK XR Rig Vuforia以外,必不可少的还需要一个名为EventSystem东西,负责在场景一开始调用MRTK INPut也就是手部输入。

缺少EventSystem可以自己在Hierarchy中右键,点击新建Creat Empty,改名为EventSystem,然后在右侧Inspector里面右键,加入Event System和XR UI Input Module两个模块。

MRTKINPUT
MRTKINPUT

这样重新进入项目就会有手部了

还有一种可能导致该问题的原因:场景里面有两个MAIN CAMERA,MRTK XR RIG自带一个MAIN CAMERA,场景里面也有一个原始的Main Camera,这俩一冲突也会导致一些问题。