User-friendly array elements?

Godot Version

4.3 stable

Question

A bit of a luxury question here.

I’m very concerned with user-friendly-ness (for my present and future self).
I really find resources useful, truly. Exposing an array of resources is not cutting it for me, at least with the way i know how to.

I do this:

@export_group("Player stats")
@export var playerStats : Array[StatData]

And the StatData is a resource with @export variables, bla bla. Never mind that.

But it looks like this…

And honestly, this makes we want to just have a set of raw variables in code. That makes me a bit sad.

Are there a way to visualize the array in a better way? Say make the array show the first entry as its name/resource type kind of thing? Like so:

Imagine having 50 player stats, i wanna save, or 200 whatnots…? yikes.

You would have to make a plugin, Godot does not know how you want to display your custom types without some plugin code to help it.

Though, if you save your StatData as a file it will show the filename.tres instead of “StatData”. You could also consider using a Dictionary instead of an Array of what I assume are key/value pairs.

4 Likes

Oh yes a dictionary. That sounds promising. Maybe.
I’ll check it out. And see.
Though… the thing is my resource has like 10 entries. Ie string name, how much x, discription and the like. So if dictionary only gives me a pair it might not be feasible for me to use it. :thinking::thinking:

1 Like

A Dictionary might not cut it for you, though descriptions sound like they should be universal, all “health” could be described the same way. Maybe some of the resource data can be compartmentalized elsewhere.

For example, I made a bottom panel plugin to showing wave information. The default resource view is very hard to work with, but I can tailor make my plugin to fit my needs and visualize better.

5 Likes

Wow. That view to the right is a plugin you made? I have to look into that. :heart_eyes::heart_eyes::heart_eyes:
That totally looks like something I could get to look exactly how I like it.
plugins sounds daunting though