From db232e31e7218c36cf2a3452c9345d05fa3f0554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kan=20Sidenvall?= Date: Fri, 20 Dec 2024 13:13:01 +0100 Subject: [PATCH] FIX: Avoid problems with CI and reimports (#2091) --- Packages/com.unity.inputsystem/CHANGELOG.md | 1 + .../Editor/AssetImporter/InputActionImporter.cs | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 2a36143974..7d11b796b5 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -34,6 +34,7 @@ however, it has to be formatted properly to pass verification tests. - Fixed an issue with default device selection when adding new Control Scheme. - Fixed an issue where action map delegates were not updated when the asset already assigned to the PlayerInput component were changed [ISXB-711](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-711). - Fixed Action properties edition in the UI Toolkit version of the Input Actions Asset editor. [ISXB-1277](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1277) +- Fixed an issue where batch jobs would fail with "Error: Error building Player because scripts are compiling" if a source generated .inputactions asset is out of sync with its generated source code (ISXB-1300). ### Changed - Added back the InputManager to InputSystem project-wide asset migration code with performance improvement (ISX-2086). diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs index 6aa8af8a3a..6a625feb96 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs @@ -256,11 +256,11 @@ private static void GenerateWrapperCode(AssetImportContext ctx, InputActionAsset if (InputActionCodeGenerator.GenerateWrapperCode(wrapperFilePath, asset, options)) { - // When we generate the wrapper code cs file during asset import, we cannot call ImportAsset on that directly because - // script assets have to be imported before all other assets, and are not allowed to be added to the import queue during - // asset import. So instead we register a callback to trigger a delayed asset refresh which should then pick up the - // changed/added script, and trigger a new import. - EditorApplication.delayCall += AssetDatabase.Refresh; + // This isn't ideal and may have side effects, but we cannot avoid compiling again. + // Previously we attempted to run a EditorApplication.delayCall += AssetDatabase.Refresh + // but this would lead to "error: Error building Player because scripts are compiling" in CI. + // Previous comment here warned against not being able to reimport here directly, but it seems it's ok. + AssetDatabase.ImportAsset(wrapperFilePath); } }