diff options
author | Adam Scott <ascott.ca@gmail.com> | 2023-01-10 20:08:46 -0500 |
---|---|---|
committer | Adam Scott <ascott.ca@gmail.com> | 2023-01-12 10:27:38 -0500 |
commit | e3e55b29cec2dd62f268f24c43c07886378607ad (patch) | |
tree | 36d18d4c4db01a14da4bbca943ebcb8ba5e1e61d /modules/gdscript/gdscript.cpp | |
parent | 4ac649d8386b805f5857b545c6404515da25d4f7 (diff) |
Add default virtual `gdscript://` path to `GDScript` instances
Diffstat (limited to 'modules/gdscript/gdscript.cpp')
-rw-r--r-- | modules/gdscript/gdscript.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 7b79c9cf7e..28f478e9cd 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -1037,7 +1037,7 @@ String GDScript::get_script_path() const { } Error GDScript::load_source_code(const String &p_path) { - if (p_path.is_empty() || ResourceLoader::get_resource_type(p_path.get_slice("::", 0)) == "PackedScene") { + if (p_path.is_empty() || p_path.begins_with("gdscript://") || ResourceLoader::get_resource_type(p_path.get_slice("::", 0)) == "PackedScene") { return OK; } @@ -1363,6 +1363,8 @@ GDScript::GDScript() : GDScriptLanguage::get_singleton()->script_list.add(&script_list); } + + path = vformat("gdscript://%d.gd", get_instance_id()); } void GDScript::_save_orphaned_subclasses(GDScript::ClearData *p_clear_data) { |