GUI Template Issues

I’m currently trying to make a simple match-3 puzzle game in hopes of learning the basics of Defold.

Currently I’ve set up a main_gui which is attempting to clone a gui template for each boardspace. I have a board space template as a child node of the main_gui and in my code I’m doing the following:

local tile_template = gui.get_node("tile_template")

But this seems to cause an error:

No such node:

Are template not considered nodes? When I create a box node and name it, gui.get_node seems to work correctly.

Also I noticed that the gui_script that exists on my tile_template doesn’t seem to be running.

Anyone have any ideas why my scripts aren’t working properly?

Thanks!

Most things seem expected, check here: http://www.defold.com/manuals/gui-templates/

Hmmm…so assuming I set up the gui the following way:

gui.get_node("/tile_template/box") works.

However, I’m trying to use gui.clone_tree to clone the entire tile_template. I guess I’ll have to make another top level node within my template so that it can be cloned.

The template is not a node in itself, and that is very easy to forget - I did it myself recently. So “tile_template” does not exist in runtime. Just create a tree in the template and you can clone it.