From 56b2c96b3b821a519973a736166fb08e68ac6fb4 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 25 Feb 2025 17:43:56 +0100 Subject: [PATCH] Fix missing content database load when opening project without code compilation #2469 --- Source/Editor/Modules/ContentDatabaseModule.cs | 11 +++++++++++ Source/Editor/Modules/SceneModule.cs | 2 +- Source/Editor/Modules/UIModule.cs | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Source/Editor/Modules/ContentDatabaseModule.cs b/Source/Editor/Modules/ContentDatabaseModule.cs index 2eee39221..a21fb3b53 100644 --- a/Source/Editor/Modules/ContentDatabaseModule.cs +++ b/Source/Editor/Modules/ContentDatabaseModule.cs @@ -21,6 +21,7 @@ namespace FlaxEditor.Modules private bool _enableEvents; private bool _isDuringFastSetup; private bool _rebuildFlag; + private bool _rebuildInitFlag; private int _itemsCreated; private int _itemsDeleted; private readonly HashSet _dirtyNodes = new HashSet(); @@ -820,6 +821,7 @@ namespace FlaxEditor.Modules Profiler.BeginEvent("ContentDatabase.Rebuild"); var startTime = Platform.TimeSeconds; _rebuildFlag = false; + _rebuildInitFlag = false; _enableEvents = false; // Load all folders @@ -1240,6 +1242,15 @@ namespace FlaxEditor.Modules FlaxEngine.Scripting.InvokeOnUpdate(() => OnImportFileDone(path)); }; _enableEvents = true; + _rebuildInitFlag = true; + } + + /// + public override void OnEndInit() + { + // Handle init when project was loaded without scripts loading () + if (_rebuildInitFlag) + RebuildInternal(); } private void OnImportFileDone(string path) diff --git a/Source/Editor/Modules/SceneModule.cs b/Source/Editor/Modules/SceneModule.cs index a144d6f4c..f1fae600d 100644 --- a/Source/Editor/Modules/SceneModule.cs +++ b/Source/Editor/Modules/SceneModule.cs @@ -58,7 +58,7 @@ namespace FlaxEditor.Modules : base(editor) { // After editor cache but before the windows - InitOrder = -900; + InitOrder = -800; } /// diff --git a/Source/Editor/Modules/UIModule.cs b/Source/Editor/Modules/UIModule.cs index cbd94ef41..67df5a2e8 100644 --- a/Source/Editor/Modules/UIModule.cs +++ b/Source/Editor/Modules/UIModule.cs @@ -160,7 +160,7 @@ namespace FlaxEditor.Modules internal UIModule(Editor editor) : base(editor) { - InitOrder = -90; + InitOrder = -70; VisjectSurfaceBackground = FlaxEngine.Content.LoadAsyncInternal("Editor/VisjectSurface"); ColorValueBox.ShowPickColorDialog += ShowPickColorDialog; }