diff options
author | Raul Santos <raulsntos@gmail.com> | 2023-10-16 02:55:52 +0200 |
---|---|---|
committer | Raul Santos <raulsntos@gmail.com> | 2023-10-16 05:07:11 +0200 |
commit | be1dfd3b3ab53b5ea6678b1ca974864385e55272 (patch) | |
tree | 58ef7685e8f731eb744862cb55202774170f1863 /modules/mono/csharp_script.cpp | |
parent | a574c0296b38d5f786f249b12e6251e562c528cc (diff) | |
download | redot-engine-be1dfd3b3ab53b5ea6678b1ca974864385e55272.tar.gz |
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.
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r-- | modules/mono/csharp_script.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 23d0eb8b67..44bcd4cfe4 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -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() { |