@@ -71,6 +71,16 @@ internal partial class InputManager
7171 static readonly ProfilerMarker k_InputRestoreDevicesAfterReloadMarker = new ProfilerMarker ( "InputManager.RestoreDevicesAfterDomainReload" ) ;
7272 static readonly ProfilerMarker k_InputRegisterCustomTypesMarker = new ProfilerMarker ( "InputManager.RegisterCustomTypes" ) ;
7373
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+
7484 public InputMetrics metrics
7585 {
7686 get
@@ -600,7 +610,7 @@ private void PerformLayoutPostRegistration(InternedString layoutName, InlinedArr
600610
601611 // Let listeners know.
602612 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" ) ;
604614 }
605615
606616 public void RegisterPrecompiledLayout < TDevice > ( string metadata )
@@ -868,7 +878,7 @@ public void RemoveControlLayout(string name)
868878 //// remove those layouts, too
869879
870880 // 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" ) ;
872882 }
873883
874884 public InputControlLayout TryLoadControlLayout ( Type type )
@@ -1121,7 +1131,7 @@ private void NotifyUsageChanged(InputDevice device)
11211131 InputActionState . OnDeviceChange ( device , InputDeviceChange . UsageChanged ) ;
11221132
11231133 // 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" ) ;
11251135
11261136 ////REVIEW: This was for the XRController leftHand and rightHand getters but these do lookups dynamically now; remove?
11271137 // Usage may affect current device so update.
@@ -1287,7 +1297,7 @@ public void AddDevice(InputDevice device)
12871297 device . MakeCurrent ( ) ;
12881298
12891299 // 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" ) ;
12911301
12921302 // Request device to send us an initial state update.
12931303 if ( device . enabled )
@@ -1442,7 +1452,7 @@ public void RemoveDevice(InputDevice device, bool keepOnListOfAvailableDevices =
14421452 device . NotifyRemoved ( ) ;
14431453
14441454 // 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" ) ;
14461456
14471457 // Try setting next device of same type as current
14481458 InputSystem . GetDevice ( device . GetType ( ) ) ? . MakeCurrent ( ) ;
@@ -1466,7 +1476,7 @@ public unsafe void ResetDevice(InputDevice device, bool alsoResetDontResetContro
14661476 // Trigger reset notification.
14671477 var change = isHardReset ? InputDeviceChange . HardReset : InputDeviceChange . SoftReset ;
14681478 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") ;
14701480
14711481 // If the device implements its own reset, let it handle it.
14721482 if ( ! alsoResetDontResetControls && device is ICustomDeviceReset customReset )
@@ -1754,7 +1764,7 @@ public void EnableOrDisableDevice(InputDevice device, bool enable, DeviceDisable
17541764
17551765 // Let listeners know.
17561766 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" ) ;
17581768 }
17591769
17601770 private unsafe void QueueEvent ( InputEvent * eventPtr )
@@ -2500,7 +2510,7 @@ private void OnNativeDeviceDiscovered(int deviceId, string deviceDescriptor)
25002510 AddDevice ( device ) ;
25012511
25022512 DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners , device , InputDeviceChange . Reconnected ,
2503- "InputSystem.onDeviceChange" ) ;
2513+ k_InputOnDeviceChangeMarker , "InputSystem.onDeviceChange" ) ;
25042514 }
25052515 else
25062516 {
@@ -2709,7 +2719,7 @@ private void OnBeforeUpdate(InputUpdateType updateType)
27092719 }
27102720 }
27112721
2712- DelegateHelpers . InvokeCallbacksSafe ( ref m_BeforeUpdateListeners , " onBeforeUpdate") ;
2722+ DelegateHelpers . InvokeCallbacksSafe ( ref m_BeforeUpdateListeners , k_InputOnBeforeUpdateMarker , "InputSystem. onBeforeUpdate") ;
27132723 }
27142724
27152725 /// <summary>
@@ -2824,14 +2834,14 @@ internal void ApplySettings()
28242834
28252835 // Let listeners know.
28262836 DelegateHelpers . InvokeCallbacksSafe ( ref m_SettingsChangedListeners ,
2827- "InputSystem.onSettingsChange" ) ;
2837+ k_InputOnSettingsChangeMarker , "InputSystem.onSettingsChange" ) ;
28282838 }
28292839
28302840 #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
28312841 internal void ApplyActions ( )
28322842 {
28332843 // Let listeners know.
2834- DelegateHelpers . InvokeCallbacksSafe ( ref m_ActionsChangedListeners , "InputSystem.onActionsChange" ) ;
2844+ DelegateHelpers . InvokeCallbacksSafe ( ref m_ActionsChangedListeners , k_InputOnActionsChangeMarker , "InputSystem.onActionsChange" ) ;
28352845 }
28362846
28372847 #endif
@@ -3448,7 +3458,7 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev
34483458 if ( m_EventListeners . length > 0 )
34493459 {
34503460 DelegateHelpers . InvokeCallbacksSafe ( ref m_EventListeners ,
3451- new InputEventPtr ( currentEventReadPtr ) , device , "InputSystem.onEvent" ) ;
3461+ new InputEventPtr ( currentEventReadPtr ) , device , k_InputOnEventMarker , "InputSystem.onEvent" ) ;
34523462
34533463 // If a listener marks the event as handled, we don't process it further.
34543464 if ( currentEventReadPtr ->handled )
@@ -3590,7 +3600,7 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev
35903600 ArrayHelpers . AppendWithCapacity ( ref m_DisconnectedDevices ,
35913601 ref m_DisconnectedDevicesCount , device ) ;
35923602 DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners ,
3593- device , InputDeviceChange . Disconnected , "InputSystem.onDeviceChange" ) ;
3603+ device , InputDeviceChange . Disconnected , k_InputOnDeviceChangeMarker , "InputSystem.onDeviceChange" ) ;
35943604 }
35953605
35963606 break ;
@@ -3600,7 +3610,7 @@ private unsafe void OnUpdate(InputUpdateType updateType, ref InputEventBuffer ev
36003610 device . NotifyConfigurationChanged ( ) ;
36013611 InputActionState . OnDeviceChange ( device , InputDeviceChange . ConfigurationChanged ) ;
36023612 DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceChangeListeners ,
3603- device , InputDeviceChange . ConfigurationChanged , "InputSystem.onDeviceChange" ) ;
3613+ device , InputDeviceChange . ConfigurationChanged , k_InputOnDeviceChangeMarker , "InputSystem.onDeviceChange" ) ;
36043614 break ;
36053615
36063616 case DeviceResetEvent . Type :
@@ -3716,7 +3726,7 @@ private void InvokeAfterUpdateCallback(InputUpdateType updateType)
37163726 return ;
37173727
37183728 DelegateHelpers . InvokeCallbacksSafe ( ref m_AfterUpdateListeners ,
3719- "InputSystem.onAfterUpdate" ) ;
3729+ k_InputOnAfterUpdateMarker , "InputSystem.onAfterUpdate" ) ;
37203730 }
37213731
37223732 private bool m_ShouldMakeCurrentlyUpdatingDeviceCurrent ;
@@ -3897,7 +3907,7 @@ internal unsafe bool UpdateState(InputDevice device, InputUpdateType updateType,
38973907
38983908 // Notify listeners.
38993909 DelegateHelpers . InvokeCallbacksSafe ( ref m_DeviceStateChangeListeners ,
3900- device , eventPtr , "InputSystem.onDeviceStateChange" ) ;
3910+ device , eventPtr , k_InputOnDeviceSettingsChangeMarker , "InputSystem.onDeviceStateChange" ) ;
39013911
39023912 // Now that we've committed the new state to memory, if any of the change
39033913 // monitors fired, let the associated actions know.
0 commit comments