Note: This page is still a work in progress. There are a lot of meta specifiers still to document!
Unreal's USTRUCT Specifiers page lists all of the core specifiers but a lot of the metadata specifiers that it lists are only usable with UCLASS.
This page attempts to be an exhaustive list of all the USTRUCT
specifiers,
giving explanations, sample code, screenshots and related links for each.
If you know of any not listed here, or see any mistakes, feel free to contact me.
Special thanks to Erekose Craft, Ben Fox, Aquanox, ATankNoMore for finding meta properties, giving feedback and giving great examples of usage.
The YAML files used to generate this documentation are available on GitHub. Feel free to submit pull requests or submit any incorrect or missing information there.
General Points
- Tags are case insensitive, but I would recommend sticking to the case example here for readability.
- Quotation marks are optional if the values does not have spaces. e.g.
someBool=true
is treated the same assomeBool="true"
. Again, for readability I would recommend using quotation marks only around string-type properties.
Blueprint Logic
USTRUCT(
BlueprintType
)
Position:
Main
Type:
flag
Setting this allows the struct to be added as a variable to Blueprints. To expose a struct to blueprints with BlueprintReadOnly
, the struct must be marked with BlueprintType
.
Exposes this struct as a type that can be used for variables in Blueprints.
USTRUCT(meta=(
HiddenByDefault
))
Position:
Meta
Type:
flag
Pins in Make and Break nodes are hidden by default.
USTRUCT(meta=(
DisableSplitPin
))
Position:
Meta
Type:
flag
Related:
"Split Struct Pin" is an option available when right-clicking the return node of a UFUNCTION
. It is only available if all the variables within the struct are exposed to blueprints, and if DisableSplitPin
is not present in the USTRUCT definition.
Why you might want to use it is a more interesting question. The only example of this being used in the codebase is with FGameplayTag
. Gameplay tags are structs but only contain an FName
property that is used as their ID. I suppose that DisableSplitPin
is used because Epic wanted to discourage users from splitting the struct out to FName
when it's much more helpful to keep it as an FStruct
and use all the helper functions within.
Indicates that node pins of this struct type cannot be split
USTRUCT(meta=(DisableSplitPin))
struct FGameplayTag
{
GENERATED_BODY()
UPROPERTY(VisibleAnywhere, Category = GameplayTags)
FName TagName;
};
USTRUCT(meta=(
HasNativeBreak
="abc"))
Position:
Meta
Type:
string (Function name)
Related:
HasNativeBreak
lets you specify a static UFUNCTION()
to use instead of the default behavior when a user chooses "Break (Struct)"
By default all properties marked as BlueprintReadOnly
or BlueprintReadWrite
would be present in the node. Defining a native break function can let you customize what is present in that node.
Indicates that the struct has a custom break node (and what the path to the BlueprintCallable UFunction is) that should be used instead of the default BreakStruct node.
USTRUCT(BlueprintType, meta = (HasNativeBreak = "ExampleProject.CatHelperLibrary.BreakCatStruct"))
struct FCat
{
GENERATED_BODY()
public:
UPROPERTY()
FString Name;
UPROPERTY()
FLinearColor CoatColor;
UPROPERTY()
FString SecretPetName;
};
UCLASS()
class UCatHelperLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintPure, Category = "Cat", meta = (BlueprintThreadSafe))
static void BreakCatStruct(const FCat& Cat, FString& OutName, FLinearColor& OutCoatColor);
};
void UCatHelperLibrary::BreakCatStruct(const FCat& Cat, FString& OutName, FLinearColor& OutCoatColor)
{
OutName = Cat.Name;
OutCoatColor = Cat.CoatColor;
}
USTRUCT(meta=(
HasNativeMake
="abc"))
Position:
Meta
Type:
string (Function name)
Related:
Similar to HasNativeBreak
, HasNativeMake
allows you to specify a static
UFUNCTION()
to use to create and fill the values of a struct, without having to make the values within the struct BlueprintReadWrite
.
Indicates that the struct has a custom make node (and what the path to the BlueprintCallable UFunction is) that should be used instead of the default MakeStruct node.
USTRUCT(BlueprintType, meta = (HasNativeMake = "ExampleProject.CatHelperLibrary.MakeCatStruct"))
struct FCat
{
GENERATED_BODY()
public:
UPROPERTY()
FString Name;
UPROPERTY()
FLinearColor CoatColor;
UPROPERTY()
FString SecretPetName;
};
UCLASS()
class UCatHelperLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintPure, Category = "Cat", meta = (BlueprintThreadSafe))
static FCat MakeCatStruct(FString Name, FLinearColor CoatColor);
};
FCat UCatHelperLibrary::MakeCatStruct(FString Name, FLinearColor CoatColor)
{
FCat Cat;
Cat.Name = Name;
Cat.CoatColor = CoatColor;
return Cat;
}
C++
USTRUCT(
NoExport
)
Position:
Main
Type:
flag
"No autogenerated code will be created" means you don't need to write GENERATED_BODY
No autogenerated code will be created for this class; the header is only provided for parsing metadata.
Deprecated
USTRUCT(
Immutable
)
Position:
Main
Type:
flag
Immutable is only legal in Object.h and is being phased out, do not use on new structs!.
USTRUCT(
Atomic
)
Position:
Main
Type:
flag
This is listed in the official documentation but I can't find a single use of it inside the Unreal Engine codebase.
Indicates that this struct should always be serialized as a single unit. No autogenerated code will be created for this class; the header is only provided to parse metadata from.