Properties
Selection and Inspector export
| Mode |
Registered property |
Exported property |
| Inferred |
@Visible, @Storage, @Export, or a property hint |
@Export or a property hint |
| Explicit |
@Visible, @Storage, @Export, or a property hint |
@Export or a property hint |
| Automatic |
Public compatible property |
Every registered property, unless @Visible or @Storage is written |
@Export carries @Storage, which carries @Visible: the most specific one written decides the exposure. Property annotations belong to godot.annotation. A field must be public and non-static when there are no accessors. When accessors exist, every present getter/setter must be public. A private backing field can be exposed through public accessors. A registration annotation on a field that does not meet this fails the build.
These forms register and export health in all three modes:
Accessors and function intent
Property shape and function selection are separate. Annotation placement must be legal for the source language: @Visible/@Export target properties or fields; @Register targets methods.
| Resolved annotations |
Accessor treatment |
No @Register on an accessor |
Property candidate; still needs selection by the current mode |
@Register on an accessor, no resolved @Visible on the property |
Callable function; property suppressed |
@Register on an accessor and resolved @Visible on the property |
Both property and function |
Types and initialization
Registered properties accept Variant-compatible values, core Godot types, Node/Resource references, enums, BitField<E>, and Lists of enums. See types and conversions for the precise distinction between property and method types.
Primitive, string, and core-type properties cannot be nullable. Kotlin primitive/core-type properties cannot be lateinit; initialize them. Node and Resource references may be null. Java and Scala carry no reliable nullability information, so the build cannot check this for them: a null reaching a primitive, string, core-type or enum property, parameter or return value fails at runtime instead. Any/Object allows a dynamic Variant value, not arbitrary JVM objects.
A getter-only or final property has no setter available to Godot. It does not become writable by adding @Export.
Inspector hints
A property can have at most one hint. Enum and bitfield hints are also generated from the property type, so an extra incompatible hint is not a way to combine Inspector controls. Hint/type mismatches fail registration validation. See Property hints.
Single enum (dropdown)
Declare a property whose type is an enum:
Bitfield (flags)
Use BitField<MyEnum> (from godot.core) when several enum values can be selected at once:
For regular enums, each constant gets the bit at its ordinal (1 << ordinal).
List of enums
A property declared as a List of enums becomes a resizable list where each element is a dropdown. Kotlin accepts List or MutableList, Java uses java.util.List, and Scala uses java.util.List rather than its own List. Other collection types, such as Set, are rejected. The list keeps order and duplicates.
Inspector values
Saved Inspector values are applied after construction and before _enter_tree(). Initializers supply defaults; read the saved values in _ready(). Exported core-type fields need an initial value or the build fails.
Node, Resource, and container exports
The following members use Inferred mode. Texture2D is a Resource subclass.
Inspector sections
@Category, @Group, and @Subgroup insert section markers before a property while preserving its type hint. See Inspector groups for arguments and prefix matching.