Properties for .gui_script?

I was looking at making some re-usable gui_script files, but then I couldn’t find a way to make customizable properties (i.e., like go.property()). I also didn’t see a way to expose custom properties via gui templates. Is that sort of functionality possible?

I suppose maybe I could wrap the gui in a game object file, expose properties via the regular game object script, and forward those properties on to my gui_script, but that feels like a fair amount of overhead. Hmm…

There is unfortunately no gui.property()

Correct. GUI templates are pure presentation. It is not possible to attach a gui_script to a template and use that.

This is the only way I can think of too.

That’s unfortunate. Is there a strong technical or philosophical reason, or should I maybe open a feature request?

No, not really. At least when it comes to gui.property(). Allowing gui templates to have gui scripts is technically more challenging.

We already have ticket #4068 in our internal issue tracker for the engine and editor.

1 Like

Perfect! And yes, I was thinking about gui.property(). Thanks.

I am about to animate the set_time_step property to control a collection proxy and realised I can’t do this from a .gui file. I checked the docs, it doesn’t seem to have been implemented. Any idea of when that might be? And, in the meantime, is a module or passing message to a go file the best workarounds?

It is not planned, but it has been requested in the past (https://github.com/defold/defold/issues/4068).

Yeah, passing a message to a .script file is a good solution I think. You probably already have a script that takes care of loading and unloading proxies. Perhaps use that script file?

1 Like

This is for a tutorial, which I control with a .gui_script file. In this case it’s easiest to just add a .script file and pass a message to it to do the dirty work. Thanks for confirming, and nice that these issues are now public!

1 Like

I know this is old, but since there’s no documented way to work-around it (except for the discussion above), I added a generalized solution with detailed description and code to the GH issue. :slight_smile: