0 votes

Just wondering if something like this was possible

var Misc = $TutorialMisc/Background
Misc.set_modulate(Color(1,1,1,1))
(Object(str(Misc) + "2")).set_modulate(Color(1,1,1,1))
(Object(str(Misc) + "3")).set_modulate(Color(1,1,1,1))
#And so on...

Instead of needing to make a variable for every node like this:

var Misc = $TutorialMisc/Background
var Misc2 = $TutorialMisc/Background2
Misc.set_modulate(Color(1,1,1,1))
Misc.set_modulate(Color(1,1,1,1))
in Engine by (28 points)

1 Answer

+1 vote

You can just give your root "Control" node a custom theme and then all children nodes will conform to its theme, unless it has its own separate style features.

To do that,

  1. you just need to click on the root control node
  2. click on themes then give it a new theme.
  3. click on the new theme
  4. under default fonts give it a dynamic font
  5. and then style that dynamic font.
  6. all children nodes will now inherit that dynamic font

Throw in some codes that modify that dynamic text and then all children nodes that inherit that dynamic text will also transform.

by (271 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 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.