Skip to content

Commit a7ff585

Browse files
authored
Input Source Parent no longer cached (#10561)
* Input Source Parent no longer cached * fixed obsolete tag not working on pre unity 2020 * compiler error
1 parent 1c11a7e commit a7ff585

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Assets/MRTK/SDK/Features/UX/Scripts/Pointers/BaseControllerPointer.cs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33

44
using Microsoft.MixedReality.Toolkit.Physics;
5+
using System;
56
using System.Collections;
67
using Unity.Profiling;
78
using UnityEngine;
@@ -233,7 +234,6 @@ public override IMixedRealityController Controller
233234
basePointerName = gameObject.name;
234235
}
235236
PointerName = $"{Handedness}_{basePointerName}";
236-
InputSourceParent = base.Controller.InputSource;
237237
SetCursor();
238238
}
239239
}
@@ -273,7 +273,15 @@ public string PointerName
273273
}
274274

275275
/// <inheritdoc />
276-
public IMixedRealityInputSource InputSourceParent { get; protected set; }
276+
public IMixedRealityInputSource InputSourceParent
277+
{
278+
get { return base.Controller?.InputSource; }
279+
280+
#if UNITY_2020_3_OR_NEWER
281+
[Obsolete("Setting the Input Source Parent directly is no longer supported")]
282+
#endif
283+
protected set { Debug.LogWarning("Setting the Input Source Parent directly is no longer supported"); }
284+
}
277285

278286
/// <inheritdoc />
279287
public IMixedRealityCursor BaseCursor { get; set; }
@@ -500,9 +508,9 @@ public virtual void Reset()
500508
IsFocusLocked = false;
501509
}
502510

503-
#endregion IMixedRealityPointer Implementation
511+
#endregion IMixedRealityPointer Implementation
504512

505-
#region IEquality Implementation
513+
#region IEquality Implementation
506514

507515
private static bool Equals(IMixedRealityPointer left, IMixedRealityPointer right)
508516
{
@@ -548,9 +556,9 @@ public override int GetHashCode()
548556
}
549557
}
550558

551-
#endregion IEquality Implementation
559+
#endregion IEquality Implementation
552560

553-
#region IMixedRealitySourcePoseHandler Implementation
561+
#region IMixedRealitySourcePoseHandler Implementation
554562

555563
private static readonly ProfilerMarker OnSourceLostPerfMarker = new ProfilerMarker("[MRTK] BaseControllerPointer.OnSourceLost");
556564

@@ -584,9 +592,9 @@ public override void OnSourceLost(SourceStateEventData eventData)
584592
}
585593
}
586594

587-
#endregion IMixedRealitySourcePoseHandler Implementation
595+
#endregion IMixedRealitySourcePoseHandler Implementation
588596

589-
#region IMixedRealityInputHandler Implementation
597+
#region IMixedRealityInputHandler Implementation
590598

591599
private static readonly ProfilerMarker OnInputUpPerfMarker = new ProfilerMarker("[MRTK] BaseControllerPointer.OnInputUp");
592600

@@ -671,6 +679,6 @@ public override void OnInputDown(InputEventData eventData)
671679
}
672680
}
673681

674-
#endregion IMixedRealityInputHandler Implementation
682+
#endregion IMixedRealityInputHandler Implementation
675683
}
676684
}

0 commit comments

Comments
 (0)