Skip to content

Commit 9a1142c

Browse files
authored
FIX: PlayerInput component is redrawn all the time when the notification mode is set to Invoke Unity events (#2166)
1 parent bb6a72d commit 9a1142c

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ however, it has to be formatted properly to pass verification tests.
1919
- 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)
2020
- Fixed Input Actions code generation using locale-dependent rules when lowercasing and uppercasing strings. [ISXB-1406]
2121
- Fixed an issue when providing JoinPlayer with a specific split screen index. [ISXB-897](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-897)
22+
- 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)
2223
- 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).
2324

2425
## [1.14.0] - 2025-03-20

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -417,17 +417,21 @@ private void OnNotificationBehaviorChange()
417417
case PlayerNotifications.InvokeUnityEvents:
418418
{
419419
var playerInput = (PlayerInput)target;
420-
if (playerInput.m_DeviceLostEvent == null)
421-
playerInput.m_DeviceLostEvent = new PlayerInput.DeviceLostEvent();
422-
if (playerInput.m_DeviceRegainedEvent == null)
423-
playerInput.m_DeviceRegainedEvent = new PlayerInput.DeviceRegainedEvent();
424-
if (playerInput.m_ControlsChangedEvent == null)
425-
playerInput.m_ControlsChangedEvent = new PlayerInput.ControlsChangedEvent();
426-
serializedObject.Update();
427-
428-
// Force action refresh.
429-
m_ActionAssetInitialized = false;
430-
Refresh();
420+
421+
bool areEventsDirty = (playerInput.m_DeviceLostEvent == null) || (playerInput.m_DeviceRegainedEvent == null) || (playerInput.m_ControlsChangedEvent == null);
422+
423+
playerInput.m_DeviceLostEvent ??= new PlayerInput.DeviceLostEvent();
424+
playerInput.m_DeviceRegainedEvent ??= new PlayerInput.DeviceRegainedEvent();
425+
playerInput.m_ControlsChangedEvent ??= new PlayerInput.ControlsChangedEvent();
426+
427+
if (areEventsDirty)
428+
{
429+
serializedObject.Update();
430+
431+
// Force action refresh.
432+
m_ActionAssetInitialized = false;
433+
Refresh();
434+
}
431435
break;
432436
}
433437
}

0 commit comments

Comments
 (0)