Skip to content

Commit 41e4d57

Browse files
committed
EditorApplication.update will not work so revert
1 parent a13b163 commit 41e4d57

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

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

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -256,28 +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-
//AssetDatabase.ImportAsset(wrapperFilePath);
264-
// TODO Temporary disabled, reenable: EditorApplication.delayCall += AssetDatabase.Refresh;
265-
EditorApplication.delayCall += AssetDatabase.Refresh;
266-
if (++_importedAssetsSinceLastRefresh == 1)
267-
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);
268264
}
269265
}
270266

271-
private static int _importedAssetsSinceLastRefresh = 0;
272-
273-
private void RefreshGeneratedAssets()
274-
{
275-
EditorApplication.update -= RefreshGeneratedAssets;
276-
_importedAssetsSinceLastRefresh = 0;
277-
AssetDatabase.Refresh();
278-
}
279-
280-
281267
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
282268
internal static IEnumerable<InputActionReference> LoadInputActionReferencesFromAsset(string assetPath)
283269
{

0 commit comments

Comments
 (0)