UPROPERTY

UProperty variables are declared using standard C++ syntax with additional descriptors, such as variable specifiers and metadata placed above the declaration.

Updated over 2 years ago

Description

UProperty variables are declared using standard C++ syntax with additional descriptors, such as variable specifiers and metadata placed above the declaration.

 UPROPERTY([specifier, specifier, ...], [meta=(key=value, key=value, ...)])
 Type VariableName;

Aside from this comprehensive wiki article, the official documentation lists all valid property specifiers excluding the meta data specifiers below.

Garbage Collection

In a nutshell, Garbage Collection (GC) traverses the object hierarchy through designated UPROPERTY's, starting from the root objects (hence AddToRoot and RemoveFromRoot methods). Any object that cannot be reached through this traversal will be garbage collected. Accordingly, non-UPROPERTY variables are not counted by the GC system.

In other words, if you have two UObjects which reference each other (aka. Cyclic Reference), but no other objects refer to them, both of these UObjects will be GCed.

Valid Specifiers

Pro Tip: You can use '''using namespace UP;''' to have these keywords as enums thus potentially have them auto-complete. ''Works with VAssistX''

Pro Tip: All valid UPROPERTY specifiers are listed as enum values in "ObjectBase.h", Line 728

  • Const

    This property is const and should be exported as const.

As of at least 4.12.5, using this as a UPROPERTY specifier will cause a compilation error. Use one of the Visible* specifiers instead.

  • Config

    Property should be loaded/saved to ini file as permanent profile.

  • GlobalConfig

    Same as above but load config from base class, not subclass.

  • Localized

    Property should be loaded as localizable text. Implies ReadOnly.

  • Transient

    Property is transient: shouldn't be saved, zero-filled at load time. Opposite of the SaveGame specifier.

  • DuplicateTransient

    Property should always be reset to the default value during any type of duplication (copy/paste, binary duplication, etc.)

  • NonPIETransient

    Property should always be reset to the default value during any type of duplication (copy/paste, binary duplication, etc.)

  • Ref

    Value is copied out after function call. Only valid on function param declaration.

This is a UPARAM specifier; not a UPROPERTY specifier.

  • Export

    Object property can be exported with it's owner.

  • EditInline

    Edit this object reference inline in the editor.

  • NoClear

    Hide clear (and browse) button in the editor.

  • EditFixedSize

    Indicates that elements of an array can be modified in Editor, but its size cannot be changed.

Static arrays of containers, such as TArray, are not allowed. '''Use dynamic arrays'''.

May not work properly with container arrays of Structs. Mine were not editable. 4.12.5

  • Replicated

    Property is relevant to network replication.

  • ReplicatedUsing

    Property will be configured for replication. The provided function is called only when the replicated property is received via replication.

  • RepRetry

    Retry replication of this property if it fails to be fully sent (e.g. object references not yet available to serialize over the network)

  • NotReplicated

    Skip replication (only for struct members and parameters in service request functions).

  • Interp

    Interpolatable property for use with matinee. Always user-settable in the editor.

  • NonTransactional

    Changes to this variable value will not be included in the editor's undo/redo history.

  • Instanced

    Property is a component reference. Implies EditInline and Export.

  • BlueprintAssignable

    MC Delegates only. Property should be exposed for assigning in blueprints.

  • Category

    Specifies the category of the property within the Editor. Supports sub-categories separated by "|".

  • SimpleDisplay

    Properties appear visible by default in a details panel

  • AdvancedDisplay

    Moves the property into the Advanced dropdown in the Details panel within the Editor.

Does not appear to work within property subcategories as of 4.12.5

  • EditAnywhere

    Indicates that this property can be edited via property windows, archetypes and instances within the Editor.

  • EditInstanceOnly

    Indicates that this property can be edited by property windows, but only on instances, not on archetypes

  • EditDefaultsOnly

    Indicates that this property can be edited by property windows, but only on archetypes. This operator is incompatible with the Visible* specifiers.

  • VisibleAnywhere

    Indicates that this property is visible in property windows, but cannot be edited at all

  • VisibleInstanceOnly

    Indicates that this property is only visible in property windows for instances, not for archetypes, and cannot be edited

  • VisibleDefaultsOnly

    Indicates that this property is only visible in property windows for archetypes, and cannot be edited

  • BlueprintReadOnly

    This property can be read by blueprints, but not modified.

  • BlueprintReadWrite

    This property can be read or written from a blueprint.

  • AssetRegistrySearchable

    The AssetRegistrySearchable keyword indicates that this property and it's value will be automatically added to the asset registry for any asset class instances containing this as a member variable. It is not legal to use on struct properties or parameters.

  • SaveGame

    Property should be serialized for save game. Opposite of the Transient specifier.

  • BlueprintCallable

    Multicast Delegates only. Property should be exposed for calling in blueprint code

  • BlueprintAuthorityOnly

    MC Delegates only. This delegate accepts (only in blueprint) only events with BlueprintAuthorityOnly.

  • TextExportTransient

    Property shouldn't be exported to text format (e.g. copy/paste)

  • BindWidget

    Soon

  • BindWidgetAnim

    Soon

  • BindWidgetAnimOptional

    Soon

Valid Meta Properties

  • DisplayName

    Sets the display name for the property in the editor. The default value is the variable name with a space before each capital letter beyond the first. For example 'MyVariableName' would display as 'My Variable Name'.

Boolean variables with names that start with a lowercase "b" will be culled by default within the Editor

  • AllowAbstract

    Used for FStringClassReference properties. Indicates whether abstract class types should be shown in the class picker.

  • AllowedClasses

    Used for FStringAssetReference properties. Comma delimited list that indicates the class type(s) of assets to be displayed in the asset picker.

  • AllowPreserveRatio

    Used for FVector properties. It causes a ratio lock to be added when displaying this property in details panels.

  • ArrayClamp

    Used for integer properties. Clamps the valid values that can be entered in the UI to be between 0 and the length of the array specified.

  • ClampMin

    Used for float and integer properties. Specifies the minimum value that may be entered for the property.

Does '''not''' work with containers, such as TArray

  • ClampMax

    Used for float and integer properties. Specifies the maximum value that may be entered for the property.

Does '''not''' work with containers, such as TArray

  • DisplayThumbnail

    Indicates that the property is an asset type and it should display the thumbnail of the selected asset.

  • EditCondition

    Specifies a boolean property that is used to indicate whether editing of this property is allowed within the editor.

  • ExactClass

    Used for FStringAssetReference properties in conjunction with AllowedClasses. Indicates whether only the exact classes specified in AllowedClasses can be used or whether subclasses are valid.

  • ExposeFunctionCategories

    [Undocumented]

  • ExposeOnSpawn

    Specifies whether the property should be exposed on a Spawn Actor for the class type.

  • FixedIncrement

    [Undocumented]

  • ForceRebuildProperty

    [Undocumented]

  • HideAlphaChannel

    Used for FColor and FLinearColor properties. Indicates that the Alpha property should be hidden when displaying the property widget in the details.

  • IsBlueprintBaseOnly

    Used for FStringClassReference properties. Indicates whether only blueprint classes should be shown in the class picker.

  • OnlyPlaceable

    Used for Subclass properties. Indicates whether only placeable classes should be shown in the class picker.

  • MakeEditWidget

    When used with certain objects such as an FVector, you get to use an "edit widget" within the editor to transform the object in space.

  • MakeStructureDefaultValue

    For properties in a structure indicates the default value of the property in a blueprint make structure node.

  • MetaClass

    Used FStringClassReference properties. Indicates the parent class that the class picker will use when filtering which classes to display.

  • Multiple

    [Undocumented]

  • MultiLine

    Used for FString and FText properties. Indicates that the edit field should be multi-line, allowing entry of newlines.

    Usage: "meta=(MultiLine=true)"

  • NoElementDuplicate

    Used for array properties. Indicates that the duplicate icon should not be shown for entries of this array in the property panel.

  • NoSpinbox

    Used for integer and float properties. Indicates that the spin box element of the number editing widget should not be displayed.

  • FilePathFilter

    Used by FFilePath properties. Indicates the path filter to display in the file picker.

  • RelativePath

    Used by FDirectoryPath properties.

  • RelativeToGameContentDir

    Used by FDirectoryPath properties.

  • ShowOnlyInnerProperties

    Used for struct properties. The properties of the struct are shown directly in the details panel instead of having the need to expand them to show them.

  • SliderExponent

    [Undocumented]

  • UIMin

    Used for float and integer properties. Specifies the lowest that the value slider should represent.

  • UIMax

    Used for float and integer properties. Specifies the highest that the value slider should represent.

Related

UCLASS, UFUNCTION, USTRUCT, UMETA, UPARAM, UENUM, UDELEGATE