C#: Allow exporting games without C#

When exporting a game that contains a C# solution, a feature is added so the exported game can check if it should initialize the .NET module. Otherwise, the module initialization is skipped so games without C# won't check for the assemblies and won't show alerts when they're missing.
This commit is contained in:
Raul Santos 2023-10-16 02:55:52 +02:00
parent a574c0296b
commit be1dfd3b3a
No known key found for this signature in database
GPG key ID: B532473AE3A803E4
4 changed files with 38 additions and 12 deletions

View file

@ -121,16 +121,16 @@ void CSharpLanguage::init() {
GLOBAL_DEF(PropertyInfo(Variant::INT, "dotnet/project/assembly_reload_attempts", PROPERTY_HINT_RANGE, "1,16,1,or_greater"), 3);
#endif
gdmono = memnew(GDMono);
gdmono->initialize();
#ifdef TOOLS_ENABLED
if (gdmono->is_runtime_initialized()) {
gdmono->initialize_load_assemblies();
}
EditorNode::add_init_callback(&_editor_init_callback);
#endif
gdmono = memnew(GDMono);
// Initialize only if the project uses C#.
if (gdmono->should_initialize()) {
gdmono->initialize();
}
}
void CSharpLanguage::finish() {