Factory for Gui objects?

Hi,
I wanted to know if there is something corresponding to the Object Factory for the Gui.

What I want to do :
When I click on some buttons, I have a “Gui” object that is enabled. This Gui contain Gui “boxes”, but some Gui elements are in variable number. For normal objects, I use a Factory. But what do I do for Gui Boxes ?
My main collection is as follow :

Collection (as the name say it, that's the main.collection. I have only one)
* camera Object (camera & script)
* CreationEtoiles Object (Script & Factory)
* Cursor Object (All cursor related, aka sprite, collision box and script)
* Systeme Object (a normal object, with 0.0.0 coordinate. Contain the Gui)
** the "Gui" object (that look like a little A on a pile of papers)
*** All the stuff of a Gui (nodes, textures, etc.)

What I want to know is :
As the Factory in the CreationEtoiles object create instances of an another object (Etoile.go), how can I do the same thing with Gui Elements, like a simple Box containing various nodes ?

Hi @Vampiloup !

You can use gui.clone_tree()

Read more about the documentation on the documentation page:

1 Like

Thank you, I’m going to look at it.
If I understand well, i have to :

  1. opening the Nodes folder in "stuff.Gui " thing.
  2. Create the node “object” I want.
  3. Make him disabled.
  4. use copy_id = gui.clone_tree(node_id)
  5. gui.set_enabled(node_id, true)
1 Like