@@ -71,6 +71,16 @@ internal partial class InputManager
71
71
static readonly ProfilerMarker k_InputRestoreDevicesAfterReloadMarker = new ProfilerMarker ( "InputManager.RestoreDevicesAfterDomainReload" ) ;
72
72
static readonly ProfilerMarker k_InputRegisterCustomTypesMarker = new ProfilerMarker ( "InputManager.RegisterCustomTypes" ) ;
73
73
74
+ static readonly ProfilerMarker k_InputOnBeforeUpdateMarker = new ProfilerMarker ( "InputSystem.onBeforeUpdate" ) ;
75
+ static readonly ProfilerMarker k_InputOnAfterUpdateMarker = new ProfilerMarker ( "InputSystem.onAfterUpdate" ) ;
76
+ static readonly ProfilerMarker k_InputOnSettingsChangeMarker = new ProfilerMarker ( "InputSystem.onSettingsChange" ) ;
77
+ static readonly ProfilerMarker k_InputOnDeviceSettingsChangeMarker = new ProfilerMarker ( "InputSystem.onDeviceSettingsChange" ) ;
78
+ static readonly ProfilerMarker k_InputOnEventMarker = new ProfilerMarker ( "InputSystem.onEvent" ) ;
79
+ static readonly ProfilerMarker k_InputOnLayoutChangeMarker = new ProfilerMarker ( "InputSystem.onLayoutChange" ) ;
80
+ static readonly ProfilerMarker k_InputOnDeviceChangeMarker = new ProfilerMarker ( "InpustSystem.onDeviceChange" ) ;
81
+ static readonly ProfilerMarker k_InputOnActionsChangeMarker = new ProfilerMarker ( "InpustSystem.onActionsChange" ) ;
82
+
83
+
74
84
public InputMetrics metrics
75
85
{
76
86
get
@@ -600,7 +610,7 @@ private void PerformLayoutPostRegistration(InternedString layoutName, InlinedArr
600
610
601
611
// Let listeners know.
602
612
var change = isReplacement ? InputControlLayoutChange . Replaced : InputControlLayoutChange . Added ;
603
- DelegateHelpers . InvokeCallbacksSafe ( ref m_LayoutChangeListeners , layoutName . ToString ( ) , change , "InputSystem.onLayoutChange" ) ;
613
+ DelegateHelpers . InvokeCallbacksSafe ( ref m_LayoutChangeListeners , layoutName . ToString ( ) , change , k_InputOnLayoutChangeMarker , "InputSystem.onLayoutChange" ) ;
604
614
}
605
615
606
616
public void RegisterPrecompiledLayout < TDevice > ( string metadata )
@@ -868,7 +878,7 @@ public void RemoveControlLayout(string name)
868
878
//// remove those layouts, too
869
879
870
880
// Let listeners know.
871
- DelegateHelpers . InvokeCallbacksSafe ( ref m_LayoutChangeListeners , name , InputControlLayoutChange . Removed , "InputSystem.onLayoutChange" ) ;
881
+ DelegateHelpers . InvokeCallbacksSafe ( ref m_LayoutChangeListeners , name , InputControlLayoutChange . Removed , k_InputOnLayoutChangeMarker , "InputSystem.onLayoutChange" ) ;
872
882
}
873
883
874
884
public InputControlLayout TryLoadControlLayout ( Type type )
@@ -1121,7 +1131,7 @@ private void NotifyUsageChanged(InputDevice device)
1121
1131
InputActionState . OnDeviceChange ( device , InputDeviceChange . UsageChanged ) ;
1122
1132
1123
1133
// Notify listeners.
1124
- DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , InputDeviceChange . UsageChanged , "InputSystem.onDeviceChange" ) ;
1134
+ DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , InputDeviceChange . UsageChanged , k_InputOnDeviceChangeMarker , "InputSystem.onDeviceChange" ) ;
1125
1135
1126
1136
////REVIEW: This was for the XRController leftHand and rightHand getters but these do lookups dynamically now; remove?
1127
1137
// Usage may affect current device so update.
@@ -1287,7 +1297,7 @@ public void AddDevice(InputDevice device)
1287
1297
device . MakeCurrent ( ) ;
1288
1298
1289
1299
// Notify listeners.
1290
- DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , InputDeviceChange . Added , "InputSystem.onDeviceChange" ) ;
1300
+ DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , InputDeviceChange . Added , k_InputOnDeviceChangeMarker , "InputSystem.onDeviceChange" ) ;
1291
1301
1292
1302
// Request device to send us an initial state update.
1293
1303
if ( device . enabled )
@@ -1442,7 +1452,7 @@ public void RemoveDevice(InputDevice device, bool keepOnListOfAvailableDevices =
1442
1452
device . NotifyRemoved ( ) ;
1443
1453
1444
1454
// Let listeners know.
1445
- DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , InputDeviceChange . Removed , "InputSystem.onDeviceChange" ) ;
1455
+ DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , InputDeviceChange . Removed , k_InputOnDeviceChangeMarker , "InputSystem.onDeviceChange" ) ;
1446
1456
1447
1457
// Try setting next device of same type as current
1448
1458
InputSystem . GetDevice ( device . GetType ( ) ) ? . MakeCurrent ( ) ;
@@ -1466,7 +1476,7 @@ public unsafe void ResetDevice(InputDevice device, bool alsoResetDontResetContro
1466
1476
// Trigger reset notification.
1467
1477
var change = isHardReset ? InputDeviceChange . HardReset : InputDeviceChange . SoftReset ;
1468
1478
InputActionState . OnDeviceChange ( device , change ) ;
1469
- DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , change , " onDeviceChange") ;
1479
+ DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , change , k_InputOnDeviceChangeMarker , "InputSystem. onDeviceChange") ;
1470
1480
1471
1481
// If the device implements its own reset, let it handle it.
1472
1482
if ( ! alsoResetDontResetControls && device is ICustomDeviceReset customReset )
@@ -1754,7 +1764,7 @@ public void EnableOrDisableDevice(InputDevice device, bool enable, DeviceDisable
1754
1764
1755
1765
// Let listeners know.
1756
1766
var deviceChange = enable ? InputDeviceChange . Enabled : InputDeviceChange . Disabled ;
1757
- DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , deviceChange , "InputSystem.onDeviceChange" ) ;
1767
+ DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , deviceChange , k_InputOnDeviceChangeMarker , "InputSystem.onDeviceChange" ) ;
1758
1768
}
1759
1769
1760
1770
private unsafe void QueueEvent ( InputEvent * eventPtr )
@@ -2500,7 +2510,7 @@ private void OnNativeDeviceDiscovered(int deviceId, string deviceDescriptor)
2500
2510
AddDevice ( device ) ;
2501
2511
2502
2512
DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , InputDeviceChange . Reconnected ,
2503
- "InputSystem.onDeviceChange" ) ;
2513
+ k_InputOnDeviceChangeMarker , "InputSystem.onDeviceChange" ) ;
2504
2514
}
2505
2515
else
2506
2516
{
@@ -2709,7 +2719,7 @@ private void OnBeforeUpdate(InputUpdateType updateType)
2709
2719
}
2710
2720
}
2711
2721
2712
- DelegateHelpers . InvokeCallbacksSafe ( ref m_BeforeUpdateListeners , " onBeforeUpdate") ;
2722
+ DelegateHelpers . InvokeCallbacksSafe ( ref m_BeforeUpdateListeners , k_InputOnBeforeUpdateMarker , "InputSystem. onBeforeUpdate") ;
2713
2723
}
2714
2724
2715
2725
/// <summary>
@@ -2824,14 +2834,14 @@ internal void ApplySettings()
2824
2834
2825
2835
// Let listeners know.
2826
2836
DelegateHelpers . InvokeCallbacksSafe ( ref m_SettingsChangedListeners ,
2827
- "InputSystem.onSettingsChange" ) ;
2837
+ k_InputOnSettingsChangeMarker , "InputSystem.onSettingsChange" ) ;
2828
2838
}
2829
2839
2830
2840
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
2831
2841
internal void ApplyActions ( )
2832
2842
{
2833
2843
// Let listeners know.
2834
- DelegateHelpers . InvokeCallbacksSafe ( ref m_ActionsChangedListeners , "InputSystem.onActionsChange" ) ;
2844
+ DelegateHelpers . InvokeCallbacksSafe ( ref m_ActionsChangedListeners , k_InputOnActionsChangeMarker , "InputSystem.onActionsChange" ) ;
2835
2845
}
2836
2846
2837
2847
#endif
@@ -3448,7 +3458,7 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev
3448
3458
if ( m_EventListeners . length > 0 )
3449
3459
{
3450
3460
DelegateHelpers . InvokeCallbacksSafe ( ref m_EventListeners ,
3451
- new InputEventPtr ( currentEventReadPtr ) , device , "InputSystem.onEvent" ) ;
3461
+ new InputEventPtr ( currentEventReadPtr ) , device , k_InputOnEventMarker , "InputSystem.onEvent" ) ;
3452
3462
3453
3463
// If a listener marks the event as handled, we don't process it further.
3454
3464
if ( currentEventReadPtr ->handled )
@@ -3590,7 +3600,7 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev
3590
3600
ArrayHelpers . AppendWithCapacity ( ref m_DisconnectedDevices ,
3591
3601
ref m_DisconnectedDevicesCount , device ) ;
3592
3602
DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners ,
3593
- device , InputDeviceChange . Disconnected , "InputSystem.onDeviceChange" ) ;
3603
+ device , InputDeviceChange . Disconnected , k_InputOnDeviceChangeMarker , "InputSystem.onDeviceChange" ) ;
3594
3604
}
3595
3605
3596
3606
break ;
@@ -3600,7 +3610,7 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev
3600
3610
device . NotifyConfigurationChanged ( ) ;
3601
3611
InputActionState . OnDeviceChange ( device , InputDeviceChange . ConfigurationChanged ) ;
3602
3612
DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners ,
3603
- device , InputDeviceChange . ConfigurationChanged , "InputSystem.onDeviceChange" ) ;
3613
+ device , InputDeviceChange . ConfigurationChanged , k_InputOnDeviceChangeMarker , "InputSystem.onDeviceChange" ) ;
3604
3614
break ;
3605
3615
3606
3616
case DeviceResetEvent . Type :
@@ -3716,7 +3726,7 @@ private void InvokeAfterUpdateCallback(InputUpdateType updateType)
3716
3726
return ;
3717
3727
3718
3728
DelegateHelpers . InvokeCallbacksSafe ( ref m_AfterUpdateListeners ,
3719
- "InputSystem.onAfterUpdate" ) ;
3729
+ k_InputOnAfterUpdateMarker , "InputSystem.onAfterUpdate" ) ;
3720
3730
}
3721
3731
3722
3732
private bool m_ShouldMakeCurrentlyUpdatingDeviceCurrent ;
@@ -3897,7 +3907,7 @@ internal unsafe bool UpdateState(InputDevice device, InputUpdateType updateType,
3897
3907
3898
3908
// Notify listeners.
3899
3909
DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceStateChangeListeners ,
3900
- device , eventPtr , "InputSystem.onDeviceStateChange" ) ;
3910
+ device , eventPtr , k_InputOnDeviceSettingsChangeMarker , "InputSystem.onDeviceStateChange" ) ;
3901
3911
3902
3912
// Now that we've committed the new state to memory, if any of the change
3903
3913
// monitors fired, let the associated actions know.
0 commit comments