Open lostlont opened 3 months ago
Thanks for reporting and the detailed description!
Also this may not be a normal use case in the editor, but in CI build pipelines it would be normal to have only a release build job, without any debug build artifacts.
Note that we currently do have a CI run that checks a Rust release build (cargo build --release
) and uses a Godot release (non-editor) binary:
And there is also Option<Gd<T>>
used, with custom types:
However, we don't involve the editor here. Does your problem only appear if you set an object from the editor, and then run it? Not if you set it programmatically?
If yes, could you show the persisted scene file (with the other node attached) in both Release/Debug?
I assume that it will only appear if I set the reference in the editor, as the nodes themselves are functioning properly so I could probably set any reference to any other node at run-time. I'll try to check this later though.
Here's the scene file I used:
[gd_scene format=3 uid="uid://vmll78trsph2"]
[node name="Node3D" type="Node3D"]
[node name="TestNode" type="TestNode" parent="." node_paths=PackedStringArray("other")]
value = 42
other = NodePath("../TestNode2")
[node name="TestNode2" type="TestNode" parent="." node_paths=PackedStringArray("other")]
value = 43
other = NodePath("../TestNode")
I tried it in the editor manually and from the command line too with godot --headless --verbose --export-release windows ../build/windows/release/godot-rust-test.exe
and it produces the same issue. I haven't tried it just by running a Godot project via the Godot engine manually as I can't see any command line options to run instantly in release mode.
I checked your CI script and if I understand it properly then the sed -i'.bak' "s!/debug/!/release/!g" "$dir/rust.gdextension"
line in the check-example.sh file actually just replaces the /debug/ folder paths to release paths in the debug library references so each architecture will have both a debug and a release config pointing to the same release library. I tried running my project with a similar gdextension setup and it works in that case. So having a debug config pointing to a release library makes everything run properly. But having separate debug and release file paths and missing the debug library causes the issue in the release build.
Steps to reproduce
#[export] other: Option<Gd<Node>>
value. Print its value in the ready function.System information
Reproduced in a clean minimal project with Godot v4.2.1 on Windows, but I saw it in a normal project in v4.3-dev5 and on Linux too. Tried with gdext@e7cc36 (2024-04-15).
To make sure that it's only the
Option<Gd<Node>>
that doesn't get its value initialized I added another field with a primitive type like#[export] value: i32
set to non-zero value in the project and that indeed prints its proper value.Expected output
(From a release build where debug build was also present.)
Actual output
Note that the actual dll copied to the exported folder is the proper release configuration library. It just looks like that references are not initialized when the debug library is not present.
I have the feeling that it's expected to have a debug build of the godot-rust library always, as opening the project in the editor also shows missing components without it, however the export itself seem to be capable of handling the types and primitives of the library so I'd think that it's just malfunctioning right now. Also this may not be a normal use case in the editor, but in CI build pipelines it would be normal to have only a release build job, without any debug build artifacts.
Thank you very much