Sometimes @export variables have null values when running the project, they are definitely set in the inspector and there aren't any issues with the code. normally only one or two lines have changed from the previous build and simply resaving and rerunning the project makes it work, however it is still very annoying.
This seems to occur intermittently on all projects.
I am using Godot 4.6.2 on Linux Debian if that matters.
#Issues with @export variables returning null at startup
1 messages · Page 1 of 1 (latest)
What do you mean by "at startup", in _ready(), _init() or somewhere else entirely? Looking at variables on the same node or a different one? Any code examples of what makes it happen?
it first fails in _ready() when trying to access a non-existent property
can you show an example?
Error:
E 0:00:00:707 reset: Invalid access to property or key 'x' on a base object of type 'Nil'.
<GDScript Source>logic.gd:291 @ reset()
<Stack Trace> logic.gd:291 @ reset()
logic.gd:97 @ _ready()
pls ignore the terrible naming
I've had this issue before, and I've heard from other users here that their exports become null, and reloading the project fixes it. It seems to be some editor bug that I can't find information about online.
So there is no known fix for it then, bit annoying.