GodotSharp.SourceGenerators
GodotSharp.SourceGenerators copied to clipboard
[OnInstantiate] Unable to instantiate because of wrong resource path
When I use [OnInstantiate], the code generated has an error in the resource path. It ends up with just 1 / after the res:
private static PackedScene __Scene__ => __scene__ ??= GD.Load<PackedScene>("res:/customers/Customer.tscn");
Because of that, Godot is unable to find the file:
ERROR: Cannot open file 'res:/customers/Customer.tscn'.
at: load (scene/resources/resource_format_text.cpp:1367)
ERROR: Failed loading resource: res:/customers/Customer.tscn. Make sure resources have been imported by opening the project in the editor at least once.
at: _load (core/io/resource_loader.cpp:283)
ERROR: Error loading resource: 'res:/customers/Customer.tscn'.
at: load (core/core_bind.cpp:74)
For the reproduction, I followed the example in the README.
Godot 4.3.0 net8.0 Linux
Thanks GB. Away this week, but will address next week. Cheers :)
Here's the fix. Could you pls test for your use case and if all good I'll merge to main. Cheers :)
It worked! Thanks a lot and have a nice day ^^
Uploaded new pre-release nuget package with this fix (241016)