Repository: godotengine/godot (language: cpp)

Issue:
Can't Preload GDScript UIDs on Export Builds
### Tested versions

Tested in 4.4dev5 and 4.4dev7 -- I don't think .gd files had UIDs in prior versions.

### System information

Godot v4.4.dev7 - Windows 11 (build 22631) - Multi-window, 1 monitor - Vulkan (Mobile) - dedicated NVIDIA RTX A2000 8GB Laptop GPU (NVIDIA; 32.0.15.6103) - 12th Gen Intel(R) Core(TM) i7-12800H (20 threads)

### Issue description

Preloading a GDScript by UID works in editor builds, but does not work in exported builds.

I'd expect preloading by UID to work both in-editor and post-export, or as a worst case fail in both contexts.

### Steps to reproduce

Create some GDScript that does something. In a different script, preload it using its UID.

This will work in-editor but fail on export builds with `SCRIPT ERROR: Parse Error: Could not preload resource script "uid://dn6jx08erf1cw".`

### Minimal reproduction project (MRP)

[uid.zip](https://github.com/user-attachments/files/18276683/uid.zip)
Run the MRP and you'll see some console output.

Export it to EXE (with debug) and it will instead produce errors.


Discussion / hints:
Could be related to:
* https://github.com/godotengine/godot/issues/75617

But would need some further testing 
Can confirm, unsure about origin, this is 4.4 specific as you can't fetch the UID of scripts in 4.3
This prints when running in the editor

![Image](https://github.com/user-attachments/assets/11e1389d-0271-4b36-887d-d372d3f5cf13)

However the script is loaded.

Fix patch:
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index 50b487059bf3..60109efc4d5b 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -3952,8 +3952,9 @@ Ref<GDScriptParserRef> GDScriptAnalyzer::find_cached_external_parser_for_class(c
 
 Ref<GDScript> GDScriptAnalyzer::get_depended_shallow_script(const String &p_path, Error &r_error) {
 	// To keep a local cache of the parser for resolving external nodes later.
-	parser->get_depended_parser_for(p_path);
-	Ref<GDScript> scr = GDScriptCache::get_shallow_script(p_path, r_error, parser->script_path);
+	const String path = ResourceUID::ensure_path(p_path);
+	parser->get_depended_parser_for(path);
+	Ref<GDScript> scr = GDScriptCache::get_shallow_script(path, r_error, parser->script_path);
 	return scr;
 }
 


Test patch: