Inherited export variables end up below in inspector

Godot Version

v4.4.dev2.mono.official [97ef3c837]

Question

Is there a way to get an inherited exported variable to appear on top in the inspector?

Product inherits name from Item:

image

Product adds another exported variable products:

image

In the Inspector, Product and products end up above Item and name, as it should:

However, in some cases this is annoying. I would like to have the name field on top. Is there a way to change the order other than avoiding inheritance here?

You have 3 options from my understanding,

1: Use @export_group with a Lower Order Value

@export_group("Basic Properties", "", -10)

2: Override the Property and Make it Tool-Visible

@export var name: String:
    get:
        return super.name
    set(value):
        super.name = value

@export_group("Input")
@export var products: Array[Product] = []

Or and my personal choice but also more advanced:

3: Use Editor Script Category Hints

For more complex customization, you can use the _get_property_list() method to customize property order and categories

func _get_property_list():
    var properties = []
    properties.append({
        "name": "name",
        "type": TYPE_STRING,
        "usage": PROPERTY_USAGE_DEFAULT,
        "hint": PROPERTY_HINT_NONE,
    })
    # Add other properties...
    return properties

There may be one more way but I cant remember off the top of my head :stuck_out_tongue:

1 Like