[SOLVED] Is it possible to create table properties on scripts that show in the editor?

When I create a game object property, you have to assign the variable a value before it shows up in the editor, so that the editor knows what type the property is.

Is it possible to create a property that’s a table, or array, so that the user can specify multiple values in the editor? This would be helpful for things like spawn points, for example.

It seems not.

It only allows for these types from the script properties manual page.

What I do is define a table in a Lua module that contains the values and then I require/include this in the scripts that need them. I consider them constant values and don’t modify them. This works for me, but wouldn’t work well if many game objects all had different tables of values. What I do is more appropriate for this scenario which was never implemented as far as I know.

I don’t know of a way to do what ex. Unity or Unreal do with their array types in the editor/inspector windows. Maybe someone else has a better solution or we could suggest a workaround if we knew your use case better.

1 Like