Skip to content

Added support for generic type properties in gdscript

Rafał Mikrut requested to merge github/fork/nekomatata/generic-variable into master

Created by: pouleyKetchoupp

This change allows scripts to use untyped properties. Their type can be changed in the inspector the same way as for elements in Array or Dictionary.

This implementation uses properties of type TYPE_NIL with the existing usage flag PROPERTY_USAGE_NIL_IS_VARIANT.

Syntax for property list:

{
	"name": "generic_var",
	"type": TYPE_NIL,
	"usage": PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_NIL_IS_VARIANT,
	"hint": PROPERTY_HINT_NONE,
	"hint_string" : "",
}

Syntax for exported variable: export(Variant) var generic_export_var

Property in the inspector:

Merge request reports