Open Udargabi opened 4 weeks ago
My behavior has been consistent, personally.
You mentioned using instanced scenes. I know unique (%) node names are only visible in the scene the script is from, so I've had to replace the unique names with @export
. Maybe this is what you're experiencing?
Awaiting for a single frame in _ready() might be helpful. See: https://forum.godotengine.org/t/why-add-child-funtion-not-work-when-i-used-it-in-ready-functon/69396/8
Edit: Or maybe it's not a good idea if you are calling the var that stores the reference continuously in _process
or _physics_process
🤔
Does using @onready var
also cause this issue?
Edit2: I just assumed you are storing the reference in a var in _ready
. Could you provide some example code of what you are doing in _ready
Tested versions
godot 4.3-stable
System information
windows 10, 32 gb ram
Issue description
There are countless times when i wish to reference a node via any method (
$
/%
/get_node
etc) and godot just returns that the instance is null. After some testing i saw that none of the scene tree was loaded at the call of the_ready()
function. This just makes me sad. The first time i noticed this was when i tried to get a timer node.Steps to reproduce
I create a new scene usualy imbricated in other scenes(2-3 times) and i see results like this. In a scrip try to reference it and here you have the error.
Minimal reproduction project (MRP)
It isn`t constant