Structs

Reference to creating and implementing structs for gameplay classes.

Windows
MacOS
Linux

Structs in Unreal Engine 4 are recognized by the Engine's reflection system, but are not part of the UObject ecosystem. As a result, they are faster to create than a UObject with the same data layout, and support UProperties, but will not be managed by the Garbage Collection system and cannot provide UFunctions. To make a struct into a UStruct, use the USTRUCT tag above the struct's definition, and include GENERATED_BODY() as the first line within the definition, as follows:

USTRUCT([Specifier, Specifier, ...])
struct StructName
{
    GENERATED_USTRUCT_BODY()
};

Struct Specifiers

You can add Struct Specifiers to the struct definition to control how it behaves with various aspects of the Engine and Editor.

Struct Specifier

Effect

Atomic

No autogenerated code will be created for this class; the header is only provided to parse metadata from.

BlueprintType

Exposes this struct as a type that can be used for variables in Blueprints.

NoExport

No autogenerated code will be created for this class; the header is only provided for parsing metadata.

Metadata Specifiers

When declaring classes, interfaces, structs, enums, enum values, functions, or properties, you can add Metadata Specifiers to control how they behave with various aspects of the Engine and Editor. Each type of data structure or member has its own list of Metadata Specifiers.

Classes can use the following Metatag Specifier:

Class Meta Tag

Effect

BlueprintSpawnableComponent

If present, the Component class can be spawned by a Blueprint.

BlueprintThreadSafe

Only valid on Blueprint Function Libraries. This specifier marks the functions in this class as callable on non-game threads in Animation Blueprints.

ChildCannotTick

Used for Actor and Component classes. If the native class cannot tick, Blueprint generated classes based this Actor or Component can never tick, even if bCanBlueprintsTickByDefault is true.

ChildCanTick

Used for Actor and Component classes. If the native class cannot tick, Blueprint-generated classes based this Actor or Component can have the bCanEverTick flag overridden, even if bCanBlueprintsTickByDefault is false.

DeprecatedNode

For Behavior Tree nodes, indicates that the class is deprecated and will display a warning when compiled.

DeprecationMessage="Message Text"

If the class is deprecated, this message will be added to the standard deprecation warning when trying to compile a Blueprint that uses it.

DisplayName="Blueprint Node Name"

The name of this node in a Blueprint will be replaced with the value provided here, instead of the code-generated name.

DontUseGenericSpawnObject

Do not spawn an object of the class using Generic Create Object node in Blueprint. This specifier makes sense only for BluprintType classes that are neither Actors nor ActorComponents.

ExposedAsyncProxy

Expose a proxy object of this class in Async Task nodes.

IgnoreCategoryKeywordsInSubclasses

Used to make the first subclass of a class ignore all inherited ShowCategories and HideCategories specifiers.

IsBlueprintBase="true/false"

States that this class is (or is not) an acceptable base class for creating Blueprints, similar to the UCLASS specifiers, Blueprintable or 'NotBlueprintable`.

KismetHideOverrides="Event1, Event2, .."

List of Blueprint events that are not be allowed to be overridden.

ProhibitedInterfaces="Interface1, Interface2, .."

Lists Interfaces that are not compatible with the class.

RestrictedToClasses="Class1, Class2, .."

Used by Blueprint Function Library classes to restrict usage to the classes named in the list.

ShortToolTip="Short tooltip"

A short tooltip that is used in some contexts where the full tooltip might be overwhelming, such as the parent class picker dialog.

ShowWorldContextPin

Indicates that Blueprint nodes placed in graphs owned by this class must show their World context pins, even if they are normally hidden, because Objects of this class cannot be used as World context.

UsesHierarchy

Indicates the class uses hierarchical data. Used to instantiate hierarchical editing features in Details panels.

ToolTip="Hand-written tooltip"

Overrides the automatically generated tooltip from code comments.

Metadata Specifiers

When declaring classes, interfaces, structs, enums, enum values, functions, or properties, you can add Metadata Specifiers to control how they behave with various aspects of the Engine and Editor. Each type of data structure or member has its own list of Metadata Specifiers.

Structs can use the following Metatag Specifiers:

Struct Meta Tag

Effect

HasNativeBreak="Module.Class.Function"

Indicates that this struct has a custom Break Struct node. The module, class, and function name must be provided.

HasNativeMake="Module.Class.Function"

Indicates that this struct has a custom Make Struct node. The module, class, and function name must be provided.

HiddenByDefault

Pins in Make Struct and Break Struct nodes are hidden by default.

ShortToolTip="Short tooltip"

A short tooltip that is used in some contexts where the full tooltip might be overwhelming, such as the parent class picker dialog.

ToolTip="Hand-written tooltip

Overrides the automatically generated tooltip from code comments.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback