Skip to content

Commit fc0b11b

Browse files
committed
FIX: 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.
1 parent 2f0c02a commit fc0b11b

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ however, it has to be formatted properly to pass verification tests.
3434
- Fixed an issue with default device selection when adding new Control Scheme.
3535
- 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).
3636
- 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)
37+
- 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).
3738

3839
### Changed
3940
- Added back the InputManager to InputSystem project-wide asset migration code with performance improvement (ISX-2086).

Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -256,24 +256,14 @@ private static void GenerateWrapperCode(AssetImportContext ctx, InputActionAsset
256256

257257
if (InputActionCodeGenerator.GenerateWrapperCode(wrapperFilePath, asset, options))
258258
{
259-
// When we generate the wrapper code cs file during asset import, we cannot call ImportAsset on that directly because
260-
// script assets have to be imported before all other assets, and are not allowed to be added to the import queue during
261-
// asset import. So instead we register a callback to trigger a delayed asset refresh which should then pick up the
262-
// changed/added script, and trigger a new import.
263-
if (++_importedAssetsSinceLastRefresh == 1)
264-
EditorApplication.update += AssetDatabase.Refresh;
259+
// This isn't ideal and may have side effects, but we cannot avoid compiling again.
260+
// Previously we attempted to run a EditorApplication.delayCall += AssetDatabase.Refresh
261+
// but this would lead to "error: Error building Player because scripts are compiling" in CI.
262+
// Previous comment here warned against not being able to reimport here directly, but it seems it's ok.
263+
AssetDatabase.ImportAsset(wrapperFilePath);
265264
}
266265
}
267266

268-
private static int _importedAssetsSinceLastRefresh = 0;
269-
270-
private void RefreshGeneratedAssets()
271-
{
272-
EditorApplication.update -= RefreshGeneratedAssets;
273-
_importedAssetsSinceLastRefresh = 0;
274-
AssetDatabase.Refresh();
275-
}
276-
277267
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
278268
internal static IEnumerable<InputActionReference> LoadInputActionReferencesFromAsset(string assetPath)
279269
{

0 commit comments

Comments
 (0)