@@ -248,10 +248,10 @@ private void CreateDataProviders()
248248 MixedRealityInputSystemProfile profile = ConfigurationProfile as MixedRealityInputSystemProfile ;
249249
250250 // If the system gets disabled, the gaze provider is destroyed.
251- // Ensure that it gets recreated on when reenabled .
252- if ( GazeProvider == null )
251+ // Ensure that it gets recreated on when re-enabled .
252+ if ( GazeProvider == null && profile != null )
253253 {
254- InstantiateGazeProvider ( profile ? . PointerProfile ) ;
254+ InstantiateGazeProvider ( profile . PointerProfile ) ;
255255 }
256256
257257 if ( ( GetDataProviders ( ) . Count == 0 ) && ( profile != null ) )
@@ -272,7 +272,7 @@ private void CreateDataProviders()
272272
273273 private void InstantiateGazeProvider ( MixedRealityPointerProfile pointerProfile )
274274 {
275- if ( pointerProfile ? . GazeProviderType ? . Type != null )
275+ if ( pointerProfile != null && pointerProfile . GazeProviderType ? . Type != null )
276276 {
277277 GazeProvider = CameraCache . Main . gameObject . EnsureComponent ( pointerProfile . GazeProviderType . Type ) as IMixedRealityGazeProvider ;
278278 GazeProvider . GazeCursorPrefab = pointerProfile . GazeCursorPrefab ;
@@ -318,7 +318,7 @@ public override void Disable()
318318 GazeProvider = null ;
319319 }
320320
321- foreach ( var provider in GetDataProviders < IMixedRealityInputDeviceManager > ( ) )
321+ foreach ( var provider in GetDataProviders < IMixedRealityInputDeviceManager > ( ) )
322322 {
323323 if ( provider != null )
324324 {
@@ -991,15 +991,20 @@ public void RaiseFocusExit(IMixedRealityPointer pointer, GameObject unfocusedObj
991991 public void RaisePointerDown ( IMixedRealityPointer pointer , MixedRealityInputAction inputAction , Handedness handedness = Handedness . None , IMixedRealityInputSource inputSource = null )
992992 {
993993 // Only lock the object if there is a grabbable above in the hierarchy
994- Transform currentObject = pointer . Result ? . Details . Object ? . transform ;
994+ Transform currentObject = null ;
995+ GameObject currentGameObject = pointer . Result ? . Details . Object ;
996+ if ( currentGameObject != null )
997+ {
998+ currentObject = currentGameObject . transform ;
999+ }
9951000 IMixedRealityPointerHandler ancestorPointerHandler = null ;
996- while ( currentObject != null && ancestorPointerHandler == null )
1001+ while ( currentObject != null && ancestorPointerHandler == null )
9971002 {
998- foreach ( var component in currentObject . GetComponents < Component > ( ) )
1003+ foreach ( var component in currentObject . GetComponents < Component > ( ) )
9991004 {
10001005 if ( component is IMixedRealityPointerHandler )
10011006 {
1002- ancestorPointerHandler = ( IMixedRealityPointerHandler ) component ;
1007+ ancestorPointerHandler = ( IMixedRealityPointerHandler ) component ;
10031008 break ;
10041009 }
10051010 }
0 commit comments