From 4a1787dfbe310c776a6ccd6ae6554222b3797c68 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Wed, 20 Sep 2023 00:06:22 +0300 Subject: [PATCH] Generate project files at startup when project Cache was cleared --- Source/Editor/States/LoadingState.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Editor/States/LoadingState.cs b/Source/Editor/States/LoadingState.cs index 746c8d92b..698dc192f 100644 --- a/Source/Editor/States/LoadingState.cs +++ b/Source/Editor/States/LoadingState.cs @@ -1,6 +1,7 @@ // Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. using System; +using System.IO; using FlaxEngine; using FlaxEngine.Utilities; @@ -54,6 +55,13 @@ namespace FlaxEditor.States } else if (Editor.Options.Options.General.ForceScriptCompilationOnStartup && !skipCompile) { + // Generate project files when Cache is missing or was cleared previously + if (!Directory.Exists(Path.Combine(Editor.GameProject?.ProjectFolderPath, "Cache", "Intermediate")) || + !Directory.Exists(Path.Combine(Editor.GameProject?.ProjectFolderPath, "Cache", "Projects"))) + { + var customArgs = Editor.Instance.CodeEditing.SelectedEditor.GenerateProjectCustomArgs; + ScriptsBuilder.GenerateProject(customArgs); + } // Compile scripts before loading any scenes, then we load them and can open scenes ScriptsBuilder.Compile(); }