r/godot•
Lindbrum

You actually can have nested collections in the inspector by using @export_custom

discussion

If you read here the PROPERTY_HINT_TYPE_STRING description, i found out that you can actually have nested arrays/dictionaries in the inspector by changing the hint_string of the property.

The easy way to do it is by using the \@export_custom annotation.

In my case i wanted to declare a Dictionary[int,Array] where each Array holds instances of UnlockRequirement. I did so with the following:

\@export_custom(PROPERTY_HINT_DICTIONARY_TYPE, "int;28:24/17:UnlockRequirement") var tr_requirements : Dictionary[int,Array]

The result:

Processing img 2o266afri5ig1...

Let's break down the hint string:

int: hint string for the dictionary keys, which are plain ints

;: separates the dictionary key and value hint strings

28:24/17:UnlockRequirement: hint string for the dictionary values

28: it's the value for Array type in the Variant.Type enumeration (TYPE_ARRAY)

: is used to encode nesting so :24/17:UnlockRequirement is the hint string for the items inside the Array

24: it's the value for Object type in the Variant.Type enumeration (TYPE_OBJECT). Note that this is the internal type for any variable that inherits from a class (custom or built-in).

/: Precedes a property hint, which is used to instruct Godot about what kind of property inspector we expect.

17:UnlockRequirement: 17 is the value of PropertyHint.PROPERTY_HINT_RESOURCE_TYPE constant. This instructs Godot to give the resource picker for this Object sub-type. Then follows the type of resource I want to be pickable (this will allow me to pick/create UnlockRequirement and any resource whose type extends UnlockRequirement).

I'm not sure if there is a limit to how much you can nest this way, however the docs shows example hint strings for 3-dimensional arrays (which should cover the vast majority of use-cases!)

Posted Feb 7, 2026, 11:05 PM UTC

165
Loading comments…