0 votes

I am currently trying to automate an update to my child label to be runned in the editor, however it always returns to it's default value after I click on another node, I'ma show as it's easier than explaining:

The node structure of the scene is

World node:
    Node2D -> Box
    Node2D -> Box1

BOX, Node2D code:

extends Node2D

export(String) var ItemID = "NOONE" setget UpdateMyLabel

func _ready():

func UpdateMyLabel(newName):
    if Engine.editor_hint:

I duplicate the Box a fewer times, select the first and type in the exported var, it works, the label get's renamed, however when I select another box, the ItemID on the previous node get's reset to "NOONE", but the label doesn't update, and if I print it really changed to the default value: NOONE. Why is that?

There's not anything more running in the background, I recreated this with a clean scene.

in Engine by (373 points)

1 Answer

+2 votes
Best answer

You're gonna have to update ItemID in the set function UpdateMyLabel, it's not gonna update itself. Add ItemID = newName on the last line of the set function.

func UpdateMyLabel(newName):
    if Engine.editor_hint:
    ItemID = newName
by (189 points)
selected by
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.