I created a dialogue_machine.tscn
with a script. In it I reference this scene’s children:
(Above script is attached to the top level node “DialogueMachine”)
And it works when I play that specific scene.
But when I instantiate this scene file on my main level.tscn
…
…and hit play, the script can’t find these nodes anymore:
Is it possible to make my code robust in a way that it works in any configuration both when playing my main level.tscn
and the dialogue_machine.tscn
file itself, and make it always find its children?
The errors that say relative to "/root/Level"
. Did you accidentally attach the script to the Level
node as well as DialogueMachine
?
1 Like
Instead of referencing the node directly simply export a reference in your DialogueMachine script and then assign the correct node to that variable through the inspector.
@export var label: Label
Also, I dont’ think you need to duplicate your Label to create a shadow effect, go through the theme ovverrides in the Inspector, there might be an option to achieve the same result you are looking for
@ProgrammerOnCoffee omg that’s exactly what I did
Great catch! Thank you omg. I think I must have dragged my .gd script instead of .tscn into the tree.
@colelli I’m using a custom shader to add a special gradient to my font which affects both my fill and shadow alike. To avoid it, I make a copy of my label without the shader to manually recreate the shadow. But generally I fully agree
1 Like