[SOLVED] ERROR:SCRIPT: ui/ui.gui_script:4: No such node: menu_template stack traceback: [C]đź‘Ž in function get_node although there's a node

ERROR:SCRIPT: ui/ui.gui_script:4: No such node: menu_template
stack traceback:
  [C]:-1: in function get_node
  ui/ui.gui_script:4: in function <ui/ui.gui_script:1>

I’m confused, why is it telling me that no such node although the node exists?

gui.set_enabled(gui.get_node("menu_template"),  true)

image

To give context I have this gui inside of the main collection and the main collection is the default collection. Everything inside the gui is disabled on default, and I’m trying to enable specifically the menu template when the game starts inside ui.gui.
image

image
Someone said you can upload the game files here so here’s the link to the files, sorry for it being so big. There’s also a lot of things not working right now, I’m just trying to figure out how to enable the menu template. Thanks to anyone who replies in advance and sorry if the problem’s super obvious. It does work if you set it to be enabled by default in the editor, but I want to eventually set it programmatically based on conditions met so I’m just testing enabling it.

I’m just about to go to sleep so I don’t have time to download your files plus I’m tired, but here’s a guess:

My theory is that menu_template is a GUI template (duh), in which case “menu_template” doesn’t exist as a node. I’m thinking when you have it enabled, you never call anything like gui.get_node("menu_template") and so never get an error.

If you want to be able to enable/disable all the nodes in the template, you’ll need to create some sort of blank/invisible holder node in the template and child all the nodes to it.

Like I say - I’m tired and guessing so may be way off base here.

3 Likes

No problem, thanks for answering. hope you sleep well.

:man_facepalming: Ah I see, yup that’s probably the problem. The thing I was calling is a template instance and not a node instance, that makes sense now. Again, sorry. I will implement what you’ve suggested because that’s exactly what I’ve been needing.

2 Likes

Hope that’s the solution to your problem!

There is nothing to apologise for. Well documented questions are what make this forum a knowledge database that is useful for everyone!

1 Like

It was indeed, thank you Alex.

1 Like