Defer Editor EndInit after loading scripting assemblies

Assets containing deserialized data of scripting assembly structures
needs to be loaded after the scripting assemblies have been loaded.
This commit is contained in:
2024-06-01 20:24:57 +03:00
parent dedb3d57fd
commit 272977a521
2 changed files with 13 additions and 1 deletions

View File

@@ -223,6 +223,19 @@ void ManagedEditor::Init()
{
LOG(Info, "Loading managed assemblies (due to disabled compilation on startup)");
Scripting::Load();
const auto endInitMethod = mclass->GetMethod("EndInit");
if (endInitMethod == nullptr)
{
LOG(Fatal, "Invalid Editor assembly! Missing EndInit method.");
}
endInitMethod->Invoke(instance, nullptr, &exception);
if (exception)
{
MException ex(exception);
ex.Log(LogType::Warning, TEXT("ManagedEditor::EndInit"));
LOG_STR(Fatal, TEXT("Failed to initialize editor during EndInit! ") + ex.Message);
}
}
// Call building if need to (based on CL)

View File

@@ -71,7 +71,6 @@ namespace FlaxEditor.States
{
// Skip compilation on startup
OnCompilationEnd(true);
Editor.EndInit();
}
}