Skip to content

Commit 1ccef05

Browse files
got rid of the editor allocations from asserts in handle event method
1 parent ef363e9 commit 1ccef05

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Assets/MixedRealityToolkit-SDK/Features/Input/MixedRealityInputManager.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,14 @@ public override void HandleEvent<T>(BaseEventData eventData, ExecuteEvents.Event
262262
Debug.Assert(eventData != null);
263263
var baseInputEventData = ExecuteEvents.ValidateEventData<BaseInputEventData>(eventData);
264264
Debug.Assert(baseInputEventData != null);
265-
Debug.Assert(baseInputEventData.InputSource != null, $"Failed to find an input source for {baseInputEventData}");
266265
Debug.Assert(!baseInputEventData.used);
267266

267+
if (baseInputEventData.InputSource == null)
268+
{
269+
Debug.LogError($"Failed to find an input source for {baseInputEventData}");
270+
return;
271+
}
272+
268273
// Send the event to global listeners
269274
base.HandleEvent(eventData, eventHandler);
270275

@@ -275,7 +280,11 @@ public override void HandleEvent<T>(BaseEventData eventData, ExecuteEvents.Event
275280
return;
276281
}
277282

278-
Debug.Assert(baseInputEventData.InputSource.Pointers != null, $"InputSource {baseInputEventData.InputSource.SourceName} doesn't have any registered pointers! Input Sources without pointers should use the GazeProvider's pointer as a default fallback.");
283+
if (baseInputEventData.InputSource.Pointers == null)
284+
{
285+
Debug.LogError($"InputSource {baseInputEventData.InputSource.SourceName} doesn't have any registered pointers! Input Sources without pointers should use the GazeProvider's pointer as a default fallback.");
286+
return;
287+
}
279288

280289
// Get the focused object for each pointer of the event source
281290
for (int i = 0; i < baseInputEventData.InputSource.Pointers.Length; i++)

0 commit comments

Comments
 (0)