Skip to content

Commit 7b21b83

Browse files
authored
FIX: Delayed input backend prompt to make sure asset import is not interrupted (ISXB-608) (#2107)
1 parent 134c3b4 commit 7b21b83

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ however, it has to be formatted properly to pass verification tests.
1111
## [Unreleased] - yyyy-mm-dd
1212

1313
### Fixed
14+
- Fixed an issue where the prompt to enable the InputSystem backends would interrupt the import of large assets.
1415
- Fixed Cut Mode for Action Maps and Actions to make renaming disabled. [ISXB-1155](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1155)
1516

17+
1618
## [1.12.0] - 2025-01-15
1719

1820
### Fixed

Packages/com.unity.inputsystem/InputSystem/InputSystem.cs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3599,14 +3599,29 @@ internal static void InitializeInEditor(IInputRuntime runtime = null)
35993599
}
36003600

36013601
Debug.Assert(settings != null);
3602-
#if UNITY_EDITOR
36033602
Debug.Assert(EditorUtility.InstanceIDToObject(settings.GetInstanceID()) != null,
36043603
"InputSettings has lost its native object");
3605-
#endif
36063604

36073605
// If native backends for new input system aren't enabled, ask user whether we should
36083606
// enable them (requires restart). We only ask once per session and don't ask when
36093607
// running in batch mode.
3608+
// The warning is delayed to delay call (called a short while after the Asset are loaded, on Inspector update) to make sure it doesn't pop up while the editor is still loading or assets are not fully loaded -
3609+
// this would cancel the import of large assets that are dependent on the InputSystem package and import it as a dependency.
3610+
EditorApplication.delayCall += ShowRestartWarning;
3611+
3612+
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
3613+
// Make sure project wide input actions are enabled.
3614+
// Note that this will always fail if entering play-mode within editor since not yet in play-mode.
3615+
EnableActions();
3616+
#endif
3617+
3618+
RunInitialUpdate();
3619+
3620+
k_InputInitializeInEditorMarker.End();
3621+
}
3622+
3623+
private static void ShowRestartWarning()
3624+
{
36103625
if (!s_SystemObject.newInputBackendsCheckedAsEnabled &&
36113626
!EditorPlayerSettingHelpers.newSystemBackendsEnabled &&
36123627
!s_Manager.m_Runtime.isInBatchMode)
@@ -3622,16 +3637,7 @@ internal static void InitializeInEditor(IInputRuntime runtime = null)
36223637
}
36233638
}
36243639
s_SystemObject.newInputBackendsCheckedAsEnabled = true;
3625-
3626-
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
3627-
// Make sure project wide input actions are enabled.
3628-
// Note that this will always fail if entering play-mode within editor since not yet in play-mode.
3629-
EnableActions();
3630-
#endif
3631-
3632-
RunInitialUpdate();
3633-
3634-
k_InputInitializeInEditorMarker.End();
3640+
EditorApplication.delayCall -= ShowRestartWarning;
36353641
}
36363642

36373643
internal static void OnPlayModeChange(PlayModeStateChange change)

0 commit comments

Comments
 (0)