summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/bullet/space_bullet.cpp9
-rw-r--r--modules/gdscript/gdscript.cpp24
-rw-r--r--modules/gdscript/gdscript_parser.cpp38
-rw-r--r--modules/mono/SCsub3
-rw-r--r--modules/mono/csharp_script.cpp48
-rw-r--r--modules/mono/csharp_script.h11
-rw-r--r--modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs2
-rw-r--r--modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs2
-rw-r--r--modules/mono/editor/csharp_project.cpp9
-rw-r--r--modules/mono/editor/mono_bottom_panel.cpp8
-rw-r--r--modules/mono/mono_gd/gd_mono.cpp29
-rw-r--r--modules/mono/mono_gd/gd_mono.h4
-rw-r--r--modules/mono/utils/osx_utils.h1
13 files changed, 125 insertions, 63 deletions
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index ab841e4acf..6562b18b3c 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -678,11 +678,14 @@ void SpaceBullet::check_ghost_overlaps() {
// For each overlapping
for (i = ghostOverlaps.size() - 1; 0 <= i; --i) {
+ bool hasOverlap = false;
btCollisionObject *overlapped_bt_co = ghostOverlaps[i];
RigidCollisionObjectBullet *otherObject = static_cast<RigidCollisionObjectBullet *>(overlapped_bt_co->getUserPointer());
- if (!area->is_transform_changed() && !otherObject->is_transform_changed())
- continue;
+ if (!area->is_transform_changed() && !otherObject->is_transform_changed()) {
+ hasOverlap = true;
+ goto collision_found;
+ }
if (overlapped_bt_co->getUserIndex() == CollisionObjectBullet::TYPE_AREA) {
if (!static_cast<AreaBullet *>(overlapped_bt_co->getUserPointer())->is_monitorable())
@@ -690,8 +693,6 @@ void SpaceBullet::check_ghost_overlaps() {
} else if (overlapped_bt_co->getUserIndex() != CollisionObjectBullet::TYPE_RIGID_BODY)
continue;
- bool hasOverlap = false;
-
// For each area shape
for (y = area->get_shape_count() - 1; 0 <= y; --y) {
if (!area->get_bt_shape(y)->isConvex())
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index 9d263aa5e1..6d85eb3c90 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -223,16 +223,21 @@ void GDScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) {
void GDScript::get_script_method_list(List<MethodInfo> *p_list) const {
- for (const Map<StringName, GDScriptFunction *>::Element *E = member_functions.front(); E; E = E->next()) {
- GDScriptFunction *func = E->get();
- MethodInfo mi;
- mi.name = E->key();
- for (int i = 0; i < func->get_argument_count(); i++) {
- mi.arguments.push_back(func->get_argument_type(i));
+ const GDScript *current = this;
+ while (current) {
+ for (const Map<StringName, GDScriptFunction *>::Element *E = member_functions.front(); E; E = E->next()) {
+ GDScriptFunction *func = E->get();
+ MethodInfo mi;
+ mi.name = E->key();
+ for (int i = 0; i < func->get_argument_count(); i++) {
+ mi.arguments.push_back(func->get_argument_type(i));
+ }
+
+ mi.return_val = func->get_return_type();
+ p_list->push_back(mi);
}
- mi.return_val = func->get_return_type();
- p_list->push_back(mi);
+ current = current->_base;
}
}
@@ -642,7 +647,8 @@ Variant GDScript::call(const StringName &p_method, const Variant **p_args, int p
if (E) {
if (!E->get()->is_static()) {
- WARN_PRINT(String("Can't call non-static function: '" + String(p_method) + "' in script.").utf8().get_data());
+ ERR_EXPLAIN("Can't call non-static function: '" + String(p_method) + "' in script.");
+ ERR_FAIL_V(Variant());
}
return E->get()->call(NULL, p_args, p_argcount, r_error);
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index a012ccad30..af189fdb7e 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -811,6 +811,21 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
expr = constant;
bfn = true;
}
+
+ // Check parents for the constant
+ if (!bfn && cln->extends_file != StringName()) {
+ Ref<GDScript> parent = ResourceLoader::load(cln->extends_file);
+ if (parent.is_valid() && parent->is_valid()) {
+ Map<StringName, Variant> parent_constants;
+ parent->get_constants(&parent_constants);
+ if (parent_constants.has(identifier)) {
+ ConstantNode *constant = alloc_node<ConstantNode>();
+ constant->value = parent_constants[identifier];
+ expr = constant;
+ bfn = true;
+ }
+ }
+ }
}
if (!bfn) {
@@ -4667,7 +4682,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
}
}
#ifdef TOOLS_ENABLED
- if (subexpr->type == Node::TYPE_CONSTANT && member._export.type != Variant::NIL) {
+ if (subexpr->type == Node::TYPE_CONSTANT && (member._export.type != Variant::NIL || member.data_type.has_type)) {
ConstantNode *cn = static_cast<ConstantNode *>(subexpr);
if (cn->value.get_type() != Variant::NIL) {
@@ -5438,6 +5453,12 @@ GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source,
// Inner classes
ClassNode *outer_class = p;
while (outer_class) {
+ if (outer_class->name == id) {
+ found = true;
+ result.kind = DataType::CLASS;
+ result.class_type = outer_class;
+ break;
+ }
for (int i = 0; i < outer_class->subclasses.size(); i++) {
if (outer_class->subclasses[i] == p) {
continue;
@@ -7277,7 +7298,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
DataType cont = _resolve_type(c.type, c.expression->line);
DataType expr = _resolve_type(c.expression->get_datatype(), c.expression->line);
- if (!_is_type_compatible(cont, expr)) {
+ if (check_types && !_is_type_compatible(cont, expr)) {
_set_error("Constant value type (" + expr.to_string() + ") is not compatible with declared type (" + cont.to_string() + ").",
c.expression->line);
return;
@@ -7321,7 +7342,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
if (v.expression) {
DataType expr_type = _reduce_node_type(v.expression);
- if (!_is_type_compatible(v.data_type, expr_type)) {
+ if (check_types && !_is_type_compatible(v.data_type, expr_type)) {
// Try supertype test
if (_is_type_compatible(expr_type, v.data_type)) {
_mark_line_as_unsafe(v.line);
@@ -7783,7 +7804,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
return;
}
- if (!lh_type.has_type) {
+ if (!lh_type.has_type && check_types) {
if (op->arguments[0]->type == Node::TYPE_OPERATOR) {
_mark_line_as_unsafe(op->line);
}
@@ -7805,7 +7826,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
bool valid = false;
rh_type = _get_operation_type(oper, lh_type, arg_type, valid);
- if (!valid) {
+ if (check_types && !valid) {
_set_error("Invalid operand types ('" + lh_type.to_string() + "' and '" + arg_type.to_string() +
"') to assignment operator '" + Variant::get_operator_name(oper) + "'.",
op->line);
@@ -7828,7 +7849,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
}
#endif // DEBUG_ENABLED
- if (!_is_type_compatible(lh_type, rh_type)) {
+ if (check_types && !_is_type_compatible(lh_type, rh_type)) {
// Try supertype test
if (_is_type_compatible(rh_type, lh_type)) {
_mark_line_as_unsafe(op->line);
@@ -7864,9 +7885,11 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
#endif // DEBUG_ENABLED
}
}
+#ifdef DEBUG_ENABLED
if (!rh_type.has_type && (op->op != OperatorNode::OP_ASSIGN || lh_type.has_type || op->arguments[0]->type == Node::TYPE_OPERATOR)) {
_mark_line_as_unsafe(op->line);
}
+#endif // DEBUG_ENABLED
} break;
case OperatorNode::OP_CALL:
case OperatorNode::OP_PARENT_CALL: {
@@ -8103,7 +8126,6 @@ Error GDScriptParser::_parse(const String &p_base_path) {
check_types = false;
#endif
-#ifdef DEBUG_ENABLED
// Resolve all class-level stuff before getting into function blocks
_check_class_level_types(main_class);
@@ -8118,6 +8140,8 @@ Error GDScriptParser::_parse(const String &p_base_path) {
return ERR_PARSE_ERROR;
}
+#ifdef DEBUG_ENABLED
+
// Resolve warning ignores
Vector<Pair<int, String> > warning_skips = tokenizer->get_warning_skips();
bool warning_is_error = GLOBAL_GET("debug/gdscript/warnings/treat_warnings_as_errors").booleanize();
diff --git a/modules/mono/SCsub b/modules/mono/SCsub
index e1f5e2ef28..706949154e 100644
--- a/modules/mono/SCsub
+++ b/modules/mono/SCsub
@@ -88,6 +88,9 @@ vars.Update(env_mono)
if env_mono['mono_glue']:
env_mono.Append(CPPDEFINES=['MONO_GLUE_ENABLED'])
+if env_mono['tools'] or env_mono['target'] != 'release':
+ env_mono.Append(CPPDEFINES=['GD_MONO_HOT_RELOAD'])
+
# Configure TLS checks
import tls_configure
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 13f8385745..0b21ba3347 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -607,31 +607,10 @@ struct CSharpScriptDepSort {
void CSharpLanguage::reload_all_scripts() {
-#ifdef DEBUG_ENABLED
-
- List<Ref<CSharpScript> > scripts;
-
- {
- SCOPED_MUTEX_LOCK(script_instances_mutex);
-
- SelfList<CSharpScript> *elem = script_list.first();
- while (elem) {
- if (elem->self()->get_path().is_resource_file()) {
- scripts.push_back(Ref<CSharpScript>(elem->self())); //cast to gdscript to avoid being erased by accident
- }
- elem = elem->next();
- }
- }
-
- //as scripts are going to be reloaded, must proceed without locking here
-
- scripts.sort_custom<CSharpScriptDepSort>(); //update in inheritance dependency order
-
- for (List<Ref<CSharpScript> >::Element *E = scripts.front(); E; E = E->next()) {
- E->get()->load_source_code(E->get()->get_path());
- E->get()->reload(true);
+#ifdef GD_MONO_HOT_RELOAD
+ if (is_assembly_reloading_needed()) {
+ reload_assemblies(false);
}
-
#endif
}
@@ -639,15 +618,20 @@ void CSharpLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft
(void)p_script; // UNUSED
+ CRASH_COND(!Engine::get_singleton()->is_editor_hint());
+
#ifdef TOOLS_ENABLED
MonoReloadNode::get_singleton()->restart_reload_timer();
+#endif
+
+#ifdef GD_MONO_HOT_RELOAD
if (is_assembly_reloading_needed()) {
reload_assemblies(p_soft_reload);
}
#endif
}
-#ifdef TOOLS_ENABLED
+#ifdef GD_MONO_HOT_RELOAD
bool CSharpLanguage::is_assembly_reloading_needed() {
if (!gdmono->is_runtime_initialized())
@@ -679,11 +663,13 @@ bool CSharpLanguage::is_assembly_reloading_needed() {
return false; // No assembly to load
}
+#ifdef TOOLS_ENABLED
if (!gdmono->get_core_api_assembly() && gdmono->metadata_is_api_assembly_invalidated(APIAssembly::API_CORE))
return false; // The core API assembly to load is invalidated
if (!gdmono->get_editor_api_assembly() && gdmono->metadata_is_api_assembly_invalidated(APIAssembly::API_EDITOR))
return false; // The editor API assembly to load is invalidated
+#endif
return true;
}
@@ -781,9 +767,11 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
PlaceHolderScriptInstance *placeholder = scr->placeholder_instance_create(obj);
obj->set_script_instance(placeholder);
+#ifdef TOOLS_ENABLED
// Even though build didn't fail, this tells the placeholder to keep properties and
// it allows using property_set_fallback for restoring the state without a valid script.
scr->placeholder_fallback_enabled = true;
+#endif
// Restore Variant properties state, it will be kept by the placeholder until the next script reloading
for (List<Pair<StringName, Variant> >::Element *G = scr->pending_reload_state[obj_id].properties.front(); G; G = G->next()) {
@@ -799,13 +787,14 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
for (List<Ref<CSharpScript> >::Element *E = to_reload.front(); E; E = E->next()) {
Ref<CSharpScript> scr = E->get();
+#ifdef TOOLS_ENABLED
scr->exports_invalidated = true;
+#endif
scr->signals_invalidated = true;
scr->reload(p_soft_reload);
scr->update_exports();
{
-#ifdef DEBUG_ENABLED
for (Set<ObjectID>::Element *F = scr->pending_reload_instances.front(); F; F = F->next()) {
ObjectID obj_id = F->get();
Object *obj = ObjectDB::get_instance(obj_id);
@@ -829,7 +818,7 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
CSharpScript::StateBackup &state_backup = scr->pending_reload_state[obj_id];
// Backup placeholder script instance state before replacing it with a script instance
- obj->get_script_instance()->get_property_state(state_backup.properties);
+ si->get_property_state(state_backup.properties);
ScriptInstance *script_instance = scr->instance_create(obj);
@@ -864,17 +853,18 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) {
scr->pending_reload_state.erase(obj_id);
}
-#endif
scr->pending_reload_instances.clear();
}
}
+#ifdef TOOLS_ENABLED
// FIXME: Hack to refresh editor in order to display new properties and signals. See if there is a better alternative.
if (Engine::get_singleton()->is_editor_hint()) {
EditorNode::get_singleton()->get_inspector()->update_tree();
NodeDock::singleton->update_lists();
}
+#endif
}
#endif
@@ -2831,9 +2821,11 @@ Error ResourceFormatSaverCSharpScript::save(const String &p_path, const RES &p_r
file->close();
memdelete(file);
+#ifdef TOOLS_ENABLED
if (ScriptServer::is_reload_scripts_on_save_enabled()) {
CSharpLanguage::get_singleton()->reload_tool_script(p_resource, false);
}
+#endif
return OK;
}
diff --git a/modules/mono/csharp_script.h b/modules/mono/csharp_script.h
index e554e1f41f..8a09be79a6 100644
--- a/modules/mono/csharp_script.h
+++ b/modules/mono/csharp_script.h
@@ -82,10 +82,7 @@ class CSharpScript : public Script {
Set<Object *> instances;
-#ifdef DEBUG_ENABLED
- Set<ObjectID> pending_reload_instances;
-#endif
-
+#ifdef GD_MONO_HOT_RELOAD
struct StateBackup {
// TODO
// Replace with buffer containing the serialized state of managed scripts.
@@ -93,8 +90,8 @@ class CSharpScript : public Script {
List<Pair<StringName, Variant> > properties;
};
-#ifdef TOOLS_ENABLED
- Map<ObjectID, CSharpScript::StateBackup> pending_reload_state;
+ Set<ObjectID> pending_reload_instances;
+ Map<ObjectID, StateBackup> pending_reload_state;
#endif
String source;
@@ -313,7 +310,7 @@ public:
bool debug_break(const String &p_error, bool p_allow_continue = true);
bool debug_break_parse(const String &p_file, int p_line, const String &p_error);
-#ifdef TOOLS_ENABLED
+#ifdef GD_MONO_HOT_RELOAD
bool is_assembly_reloading_needed();
void reload_assemblies(bool p_soft_reload);
#endif
diff --git a/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs b/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
index 16beacb45c..4137f5eaef 100644
--- a/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
+++ b/modules/mono/editor/GodotSharpTools/Build/BuildSystem.cs
@@ -257,7 +257,7 @@ namespace GodotSharpTools.Build
if (null == Parameters)
throw new LoggerException("Log directory was not set.");
- string[] parameters = Parameters.Split(';');
+ string[] parameters = Parameters.Split(new[] { ';' });
string logDir = parameters[0];
diff --git a/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs b/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
index 2ce7837a27..9135006172 100644
--- a/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
+++ b/modules/mono/editor/GodotSharpTools/Project/ProjectGenerator.cs
@@ -21,6 +21,7 @@ namespace GodotSharpTools.Project
mainGroup.AddProperty("DocumentationFile", Path.Combine("$(OutputPath)", "$(AssemblyName).xml"));
mainGroup.SetProperty("RootNamespace", "Godot");
mainGroup.SetProperty("ProjectGuid", CoreApiProjectGuid);
+ mainGroup.SetProperty("BaseIntermediateOutputPath", "obj");
GenAssemblyInfoFile(root, dir, CoreApiProjectName,
new string[] { "[assembly: InternalsVisibleTo(\"" + EditorApiProjectName + "\")]" },
@@ -46,6 +47,7 @@ namespace GodotSharpTools.Project
mainGroup.AddProperty("DocumentationFile", Path.Combine("$(OutputPath)", "$(AssemblyName).xml"));
mainGroup.SetProperty("RootNamespace", "Godot");
mainGroup.SetProperty("ProjectGuid", EditorApiProjectGuid);
+ mainGroup.SetProperty("BaseIntermediateOutputPath", "obj");
GenAssemblyInfoFile(root, dir, EditorApiProjectName);
diff --git a/modules/mono/editor/csharp_project.cpp b/modules/mono/editor/csharp_project.cpp
index 4397bb9b6a..beeff51bc2 100644
--- a/modules/mono/editor/csharp_project.cpp
+++ b/modules/mono/editor/csharp_project.cpp
@@ -228,6 +228,15 @@ Error generate_scripts_metadata(const String &p_project_path, const String &p_ou
if (new_dict.size()) {
String json = JSON::print(new_dict, "", false);
+ String base_dir = p_output_path.get_base_dir();
+
+ if (!DirAccess::exists(base_dir)) {
+ DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+
+ Error err = da->make_dir_recursive(base_dir);
+ ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE);
+ }
+
Error ferr;
FileAccess *f = FileAccess::open(p_output_path, FileAccess::WRITE, &ferr);
ERR_EXPLAIN("Cannot open file for writing: " + p_output_path);
diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp
index feebdb380b..55a334bc4e 100644
--- a/modules/mono/editor/mono_bottom_panel.cpp
+++ b/modules/mono/editor/mono_bottom_panel.cpp
@@ -30,6 +30,9 @@
#include "mono_bottom_panel.h"
+#include "editor/plugins/script_editor_plugin.h"
+#include "editor/script_editor_debugger.h"
+
#include "../csharp_script.h"
#include "../godotsharp_dirs.h"
#include "csharp_project.h"
@@ -160,7 +163,12 @@ void MonoBottomPanel::_build_project_pressed() {
bool build_success = GodotSharpBuilds::get_singleton()->build_project_blocking("Tools");
if (build_success) {
+ // Notify running game for hot-reload
+ ScriptEditor::get_singleton()->get_debugger()->reload_scripts();
+
+ // Hot-reload in the editor
MonoReloadNode::get_singleton()->restart_reload_timer();
+
if (CSharpLanguage::get_singleton()->is_assembly_reloading_needed()) {
CSharpLanguage::get_singleton()->reload_assemblies(false);
}
diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp
index a422224fcb..900caefe1c 100644
--- a/modules/mono/mono_gd/gd_mono.cpp
+++ b/modules/mono/mono_gd/gd_mono.cpp
@@ -130,9 +130,14 @@ void gdmono_debug_init() {
}
#endif
- CharString da_args = String("--debugger-agent=transport=dt_socket,address=127.0.0.1:" + itos(da_port) +
- ",embedding=1,server=y,suspend=" + (da_suspend ? "y,timeout=" + itos(da_timeout) : "n"))
- .utf8();
+ CharString da_args = OS::get_singleton()->get_environment("GODOT_MONO_DEBUGGER_AGENT").utf8();
+
+ if (da_args == "") {
+ da_args = String("--debugger-agent=transport=dt_socket,address=127.0.0.1:" + itos(da_port) +
+ ",embedding=1,server=y,suspend=" + (da_suspend ? "y,timeout=" + itos(da_timeout) : "n"))
+ .utf8();
+ }
+
// --debugger-agent=help
const char *options[] = {
"--soft-breakpoints",
@@ -726,7 +731,9 @@ Error GDMono::_unload_scripts_domain() {
#endif
core_api_assembly_out_of_sync = false;
+#ifdef TOOLS_ENABLED
editor_api_assembly_out_of_sync = false;
+#endif
MonoDomain *domain = scripts_domain;
scripts_domain = NULL;
@@ -759,7 +766,7 @@ Error GDMono::_load_tools_domain() {
}
#endif
-#ifdef TOOLS_ENABLED
+#ifdef GD_MONO_HOT_RELOAD
Error GDMono::reload_scripts_domain() {
ERR_FAIL_COND_V(!runtime_initialized, ERR_BUG);
@@ -780,8 +787,12 @@ Error GDMono::reload_scripts_domain() {
#ifdef MONO_GLUE_ENABLED
if (!_load_api_assemblies()) {
- if ((core_api_assembly && (core_api_assembly_out_of_sync || !GDMonoUtils::mono_cache.godot_api_cache_updated)) ||
- (editor_api_assembly && editor_api_assembly_out_of_sync)) {
+ if ((core_api_assembly && (core_api_assembly_out_of_sync || !GDMonoUtils::mono_cache.godot_api_cache_updated))
+#ifdef TOOLS_ENABLED
+ || (editor_api_assembly && editor_api_assembly_out_of_sync)
+#endif
+ ) {
+#ifdef TOOLS_ENABLED
// The assembly was successfully loaded, but the full api could not be cached.
// This is most likely an outdated assembly loaded because of an invalid version in the
// metadata, so we invalidate the version in the metadata and unload the script domain.
@@ -805,6 +816,10 @@ Error GDMono::reload_scripts_domain() {
}
return ERR_CANT_RESOLVE;
+#else
+ ERR_PRINT("The loaded API assembly is invalid");
+ CRASH_NOW();
+#endif
} else {
return ERR_CANT_OPEN;
}
@@ -919,7 +934,9 @@ GDMono::GDMono() {
#endif
core_api_assembly_out_of_sync = false;
+#ifdef TOOLS_ENABLED
editor_api_assembly_out_of_sync = false;
+#endif
corlib_assembly = NULL;
core_api_assembly = NULL;
diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h
index 6a00b287b0..13de3061b3 100644
--- a/modules/mono/mono_gd/gd_mono.h
+++ b/modules/mono/mono_gd/gd_mono.h
@@ -95,7 +95,9 @@ class GDMono {
#endif
bool core_api_assembly_out_of_sync;
+#ifdef TOOLS_ENABLED
bool editor_api_assembly_out_of_sync;
+#endif
GDMonoAssembly *corlib_assembly;
GDMonoAssembly *core_api_assembly;
@@ -193,7 +195,7 @@ public:
GDMonoClass *get_class(MonoClass *p_raw_class);
-#ifdef TOOLS_ENABLED
+#ifdef GD_MONO_HOT_RELOAD
Error reload_scripts_domain();
#endif
diff --git a/modules/mono/utils/osx_utils.h b/modules/mono/utils/osx_utils.h
index 918642f7b2..cc72233058 100644
--- a/modules/mono/utils/osx_utils.h
+++ b/modules/mono/utils/osx_utils.h
@@ -31,6 +31,7 @@
#include "core/ustring.h"
#ifndef OSX_UTILS_H
+#define OSX_UTILS_H
#ifdef OSX_ENABLED