API reference
API reference
Select your platform
No SDKs available
No versions available

OptionalAttribute Class

Extends PropertyAttribute
Used on a SerializedField and surfaces the expectation that this field can remain empty.

Member Enumerations

Enumeration Flag

Flags that determine the visibility of the Optional tag in the editor.
None
Presents the Optional tag and moves it into the Optional Section
AutoGenerated
Indicates that if the reference is missing, a new object will be created and linked to it during runtime.
DontHide
Indicates that even though the reference is Optional, it is important for the component to work as expected.
Obsolete
Indicates that the field is obsolete and should be avoided

Properties

These flags determine the behavior of the Optional tag in the editor.

Member Functions

Create a new Optional attribute with default flags.
Create a new Optional attribute with the specified flags.
Parameters
flags
The flags that determine the behavior of this attribute.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon