How can i implement scriptable object like unity in defold?

I want to implement the scriptable object like concept from unity in Defold. is there a way i can expose variables in editor and so values can be changed in run time from editor?

1 Like

go.property might be what you’re looking for.

4 Likes

As @benjames171 suggested you could use go.property. In my projects in Defold I would say that lua modules are the closest to Unity scriptable objects.

4 Likes

Thanks @benjames171

ah now got an idea how to make it, thanks @roccosaienz

how can i export the set of values from drop down in the editor like i have stat type def, atk and hp which i want to select from editor dropdown(exposed by go.property) ?

Currently the visual representation of a go.property is limited by the type used (number, hash, url, vector3, vector4, quaternion, resource, boolean).
There is no way to specify a list of attributes that would generate a drop down or simple strings. For the latter you can use ashes with look-up tables in code, but the editor side of things in expects the user to type in the value.

@britzl @vlaaad Is it in the plan to improve this area of the editor? It would be great for example to be able to flag a vector4 in a way that could expose a color picker in the UI instead of just numeric input, or a vector3 that you can move in the layout view to get precise coordinates?
I think it was mentioned that getting a list of options (key - value) is not that easy, but I’m not sure why.

2 Likes