godot-kotlin-jvm icon indicating copy to clipboard operation
godot-kotlin-jvm copied to clipboard

Exported VariantArrays are missing type information in Godot Editor

Open MartinHaeusler opened this issue 1 year ago • 0 comments

Exporting an array in GDScript like this:

@export var nodes: Array[Node3D]

... produces a typed array editor like this:

image

Exporting the corresponding array property in Kotlin:

@Export
@RegisterProperty
var nodes: VariantArray<Node3D>? = null

... produces an untyped array editor like this:

image

Note that in the exported Kotlin property, the editor just says "Array (Size 2)" in the title, whereas in the GDScript case, it says "Array[Node 3D] (size 2)".

This issue is not merely cosmetical; in the editor resulting from kotlin code, the user can assign any resource type in the Godot editor, which will fail immediately with a type error at runtime.

@chippmann assumes that it has something to do with the way Godot 4 exports type hints for arrays.

MartinHaeusler avatar Feb 07 '24 21:02 MartinHaeusler