diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 937a8b364f..2b7ac9ed00 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -19,6 +19,7 @@ however, it has to be formatted properly to pass verification tests. - Fixed Input Actions code generation overwriting user files when the names happened to match. [ISXB-1257](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1257) - Fixed Input Actions code generation using locale-dependent rules when lowercasing and uppercasing strings. [ISXB-1406] - Fixed an issue when providing JoinPlayer with a specific split screen index. [ISXB-897](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-897) +- Fixed Inspector Window being refreshed all the time when a PlayerInput component is present with Invoke Unity Events nofication mode chosen [ISXB-1448](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1448) - Fixed an issue where an action with a name containing a slash "/" could not be found via `InputActionAsset.FindAction(string,bool)`. [ISXB-1306](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1306). ## [1.14.0] - 2025-03-20 diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs index 3abea97d0b..71ed94b213 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs @@ -417,17 +417,21 @@ private void OnNotificationBehaviorChange() case PlayerNotifications.InvokeUnityEvents: { var playerInput = (PlayerInput)target; - if (playerInput.m_DeviceLostEvent == null) - playerInput.m_DeviceLostEvent = new PlayerInput.DeviceLostEvent(); - if (playerInput.m_DeviceRegainedEvent == null) - playerInput.m_DeviceRegainedEvent = new PlayerInput.DeviceRegainedEvent(); - if (playerInput.m_ControlsChangedEvent == null) - playerInput.m_ControlsChangedEvent = new PlayerInput.ControlsChangedEvent(); - serializedObject.Update(); - - // Force action refresh. - m_ActionAssetInitialized = false; - Refresh(); + + bool areEventsDirty = (playerInput.m_DeviceLostEvent == null) || (playerInput.m_DeviceRegainedEvent == null) || (playerInput.m_ControlsChangedEvent == null); + + playerInput.m_DeviceLostEvent ??= new PlayerInput.DeviceLostEvent(); + playerInput.m_DeviceRegainedEvent ??= new PlayerInput.DeviceRegainedEvent(); + playerInput.m_ControlsChangedEvent ??= new PlayerInput.ControlsChangedEvent(); + + if (areEventsDirty) + { + serializedObject.Update(); + + // Force action refresh. + m_ActionAssetInitialized = false; + Refresh(); + } break; } }