Is it possible to make strings into object?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Marre

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))
:bust_in_silhouette: Reply From: Xian

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.