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
Blueprint Type
Position:
Main
Type:
flag
USTRUCT(BlueprintType)
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
.
Hidden By Default
Position:
Meta
Type:
flag
USTRUCT(meta=(HiddenByDefault))
Disable Split Pin
Position:
Meta
Type:
flag
Related:
USTRUCT(meta=(DisableSplitPin))
"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.
USTRUCT(meta=(DisableSplitPin))
struct FGameplayTag
{
GENERATED_BODY()
UPROPERTY(VisibleAnywhere, Category = GameplayTags)
FName TagName;
};
Has Native Break
Position:
Meta
Type:
string (Function name)
Related:
USTRUCT(meta=(HasNativeBreak="abc"))
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.
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;
}
Has Native Make
Position:
Meta
Type:
string (Function name)
Related:
USTRUCT(meta=(HasNativeMake="abc"))
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
.
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++
No Export
Position:
Main
Type:
flag
USTRUCT(NoExport)
"No autogenerated code will be created" means you don't need to write GENERATED_BODY
Deprecated
Immutable
Position:
Main
Type:
flag
USTRUCT(Immutable)
Atomic
Position:
Main
Type:
flag
USTRUCT(Atomic)
This is listed in the official documentation but I can't find a single use of it inside the Unreal Engine codebase.