Closed xill47 closed 1 day ago
It looks like ClassDB can't find the method with the provided hash.
When the ResourceLoader::load_threaded_get_status
method is bound, the computed hash is 4137685479
. This is the same hash that C# is using to retrieve the method. However, when C# tries to retrieve this method the computed hash is 1185939122
, so it doesn't match.
Why is the computed hash different? The default value for the progress
argument is an empty array ([]
), but when C# tries to retrieve this method, the default value was a non-empty array ([1]
).
It looks like when the argument is not provided, the method modifies the default array:
In your workaround, since C# retrieves the method before it's called (and thus before the default array is modified), ClassDB is able to find the method and C# caches it.
Another way to workaround this would be to provide a value for the progress
argument:
diff --git a/ThreadedLoadFromGDScript.gd b/ThreadedLoadFromGDScript.gd
index 8fc1c1c..094927c 100644
--- a/ThreadedLoadFromGDScript.gd
+++ b/ThreadedLoadFromGDScript.gd
@@ -17,7 +17,7 @@ func _process(delta):
_threaded_process()
func _threaded_process():
- var load_status = ResourceLoader.load_threaded_get_status(scene_path)
+ var load_status = ResourceLoader.load_threaded_get_status(scene_path, [])
if load_status == ResourceLoader.THREAD_LOAD_LOADED:
var node = ResourceLoader.load_threaded_get(scene_path).instantiate()
add_child(node)
This is essentially a duplicate of:
still an issue in v4.3.beta2.mono
Still in v4.3.beta3.mono
Tested versions
System information
Godot v4.3.beta1.mono - Windows 10.0.26120 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 Ti (NVIDIA; 31.0.15.5222) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)
Issue description
Originally reported here: https://discord.com/channels/212250894228652034/389794884585914368/1247671144983564370
After loading a resource with
ResourceLoader.load_threaded_request
.load_threaded_get_status
andload_threaded_get
in GDScript,ResourceLoader
becomes unusable in .NET, failing withCan be worked around by mentioning
ResourceLoader
beforehand (for example in an autoload)Steps to reproduce
TypeInitializationException
error messageMinimal reproduction project (MRP)
https://github.com/xill47/godot-dotnet-threaded-load
Workaround: https://github.com/xill47/godot-dotnet-threaded-load/tree/workaround