0 votes

Suppose I have a Button node. I attached a script like this to it:

tool
extends Button

export(String) var num

var _init():
    self.set_text(num)

Now, I want the button text to be updated in the editor automatically as I update the exported variable in the inspector (either instantly or after I save the scene). The above script is not working for me. I guess the value in the exported variable is not yet available when _init() is called.

Godot version 3.3.2
in Engine by (77 points)

Beats me. I find no mention of init in the room documentation. Did your code work if you put it into ready or process functions?

1 Answer

0 votes
tool
extends Button

export(String) var num

var _process(_delta):
    self.set_text(num)
by (4,560 points)
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 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 webmaster@godotengine.org with your username.