@export_range of a Vector3

Godot Version

Godot_v4.7.1-stable_win64

Question

I’m curious to know why this export don’t work:

@export_range(-360.0, 360.0, 0.1, "radians_as_degrees") var offset_rotation: Vector3 = Vector3.ZERO

because@export_range don’t accept Vector3 but this “workaround” work:

@export_custom(PROPERTY_HINT_RANGE, "-360,360,0.1,radians_as_degrees") var offset_rotation: Vector3 = Vector3.ZERO:

To my understanding they “should” basically do the same. I’m just curious why export_range cannot accept Vector3.

The difference is where the check happens. @export_range is validated by the GDScript parser, and that annotation is registered as expecting a numeric type, so a Vector3 gets rejected before the hint ever reaches the inspector. PROPERTY_HINT_RANGE itself has no issue with vectors, the editor applies the range to each component.

@export_custom skips that validation step. The docs say GDScript performs no validation on the syntax there, it just passes your hint string through to the property info, which is why yours works. The tradeoff is that a typo in that string won’t error either, it’ll just behave oddly in the inspector.