0 votes

Hi guys,

I recently converted from Unity to Godot, so forgive me if this is a stupid question.

I've been trying to access two nodes from a script attached to an empty root Node using get_node():

extends Label

var rgb = 0

func _process(delta):
    rgb += 0.02
    if get_node("Label").get_modulate == Color(1,1,1,1):
        get_node("Banner").visible = true

Whenever I try to run this script, I get an error telling me these two child nodes can't be found.

Here's a link to the scene tree as it appears the editor (the script is attached to Root):
Scene tree

Do you have any suggestions as to why this might be happening?

Thanks in advance

Edit: So I redid the scene tree and all of its nodes and the get_node() method spontaneously started working again. Weird.

in Engine by (12 points)
edited by

1 Answer

0 votes

I think you should get error on the first line extends Label
this should be extends Node

by (9,776 points)

Thanks for your suggestion.

I'm afraid that doesn't work though. It still just gives me an error for not being able to find the child node with get_node().

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.