Godot Version
4.4.1.stable
Question
Hi guys, greetings!
I’d like to share a problem I’ve been having to see if maybe you can help me out 
I’m working on a character for a game. I have it placed in a scene with a makeshift environment, and there are no other scenes yet. Everything was working just fine until yesterday, when I tried creating a function that only required an AudioStreamPlayer3D node. That node was meant to be a child of another node, which itself is a child of the Character3D node (all of these are children of a parent Node3D, which also has other children used to test things like collisions with the floor and walls, etc.).
The issue is that the AudioStreamPlayer3D needed to be declared in the character’s script (the script is attached to the CharacterBody), but when I try to use the @onready keyword, it can’t find it.
I’ve changed its name — still doesn’t detect it. I’ve moved it all around the character’s hierarchy (always adapting the $ path accordingly, even letting Godot autocomplete it), and it always throws an error. It shows up as null.
I’ve tried some debug prints, but nothing detects it. When I run the scene or the whole game, the variable just appears as null at the bottom of the output variables, instead of showing its item ID.
I haven’t checked any strange options on the node. I even deleted it and tested with other nodes, but now it seems like it’s not detecting any nodes at all. I duplicated and pasted the scene, and still nothing.
I’ve tried everything I can think of. What would you recommend I do to make sure the node gets properly detected and can be referenced in the script?
I’ve also double-checked the entire script, and there’s no line that deletes nodes or anything like that. Everything else works perfectly — the only issue is with the new nodes I’m trying to add.
It all started right after I saved the scene. I didn’t do anything else — I just saved it.
Since I know that saving can sometimes cause issues, I also saved the scene again after adding the new nodes (every single one I’ve tried), but they still don’t get detected.
In the first screenshot there is no script attached to the CharacterBody3D. You’re also showing some player scene in the editor, but in your tree you have a CharacterBody3D. All this makes me think you’re editing the script of the player scene, which is not in your tree, or some variation of this.
1 Like
Ohhh… so, when I changed the scene; and I duplicate it for saving; maybe the script isn’t from the character anymore and I have been editing another’s character? Omg, I will try it; thanks bro!! I will tell if that works
I keep getting similar problems. Because I like drag and drop methods.
This is also slowly disappearing from Godot. It’s a C# prefferedCallmethod error.
From experience an instance can be a child of an earlier instance.
- If it already loaded.
- And, the error appears to be a 0:00:00 frame error.
- Looks like the code is playing the sound on loading.
1 Like
i tried bro; i attach the script to the character again (it seems like it was’nt) but still doesnt work 
For the signals in Godot for example if the connection is not declared in the target I get an invalid access.
If I just make a connection code without function on the other side.
I’m guessing this is happening here. Saying you didn’t finish the code.
maybe the AudioStreamPlayer3D.play() could fix the problem.
1 Like
What if you replace the CharacterBody3D with your player scene? (Which is what you should be doing anyway. You shouldn’t want to attach scripts to random nodes in tree most of the time.)
Also, you say you duplicated the scene for saving… That sounds to me like you’re doing something pretty unorthodox here.
If it doesn’t work, tear it and down and redo from scratch.
1 Like
Guys, thank you so much for your advice and help! I managed to solve the problem. Honestly, I have no idea what exactly was wrong, but just in case someone else runs into a similar issue, here’s what I did:
I saved the player scene (starting only from the first node of the player — in my case, a CharacterBody3D, not even with a Node3D before it). I also saved its script (of course, I saved it without the problematic node or the broken part of the script). Then I disconnected everything and deleted the main scene, where I had a small testing environment. I deleted everything except what I mentioned I had saved.
After that, I simply loaded the player scene again and reconnected the saved script to the main node — exactly where it was before. Then I added the new node, declared it using @onready, and this time it got detected correctly. Everything started working perfectly again.
Now I’m just going to try to finish up the player character. I might add a few simple test elements like floors or small things like before, but I’m not going to duplicate scenes or do weird stuff like that again.
Thanks again! :)))))