UFUNCTION Specifiers - nullstar/SecondBrain GitHub Wiki

UFUNCTION Specifiers

UCLASS Specifiers | UPARAM Specifiers | UPROPERTY Specifiers | USTRUCT Specifiers






UFUNCTION(BlueprintCallable)

The function can be executed in a Blueprint or Level Blueprint graph.


UFUNCTION(BlueprintImplementableEvent)

The function can be implemented in a Blueprint or Level Blueprint graph.


UFUNCTION(BlueprintNativeEvent)

This function is designed to be overridden by a Blueprint, but also has a default native implementation. Declares an additional function named the same as the main function, but with _Implementation added to the end, which is where code should be written. The autogenerated code will call the _Implementation method if no Blueprint override is found.


UFUNCTION(meta=(ForceAsFunction))

Allows users to change a BlueprintImplementableEvent with no return value from an event into a function.


UFUNCTION(BlueprintPure)

A BlueprintPure function is shown as a node with no execution pin. By default functions marked const will be exposed as pure functions. To make a const function not a pure function, use BlueprintPure=false.

Pure functions do not cache their results, so be careful when doing any non-trivial amount of work a blueprint pure function. It is good practice to avoid outputting array properties in blueprint pure functions.

The function does not affect the owning object in any way and can be executed in a Blueprint or Level Blueprint graph.

UFUNCTION(BlueprintPure)
int32 BlueprintPureFunction();

UFUNCTION(BlueprintCallable)
int32 BlueprintCallableFunction();

UFUNCTION(BlueprintCallable)
int32 BlueprintCallableConstFunction() const;

UFUNCTION(BlueprintPure=false)
int32 BlueprintPureFalseFunction() const;

UFUNCTION(SealedEvent)

This function cannot be overridden in subclasses. The SealedEvent keyword can only be used for events. For non-event functions, declare them as static or final to seal them.


UFUNCTION(meta=(ArrayParm="abc"))

This only seems to be used in KismetArrayLibrary.h where it's used with CustomThunk-marked functions. Note that this is "ArrayParm" and not "ArrayParam".

Indicates that a BlueprintCallable function should use a Call Array Function node and that the listed parameters should be treated as wild card array properties.


UFUNCTION(meta=(ArrayTypeDependentParams="abc"))

When ArrayParm is used, this specifier indicates one parameter which will determine the types of all parameters in the ArrayParm list.


UFUNCTION(meta=(AutoCreateRefTerm="abc"))

Without AutoCreateRefTerm, a reference paramter requires that the user provide it with a value, which can be annoying for parameters that have a sensible default. When a blueprint is compiled where those parameters are not supplied with a value, an error like this will be shown "The current value of the 'Color' pin is invalid: 'Color' in action 'Some Color Without Ref' must have an input wired into it ("by ref" params expect a valid input to operate on)."

Note that it's possible to set multiple ref parameters by using a comma-separated list.

The listed parameters, although passed by reference, will have an automatically created default if their pins are left disconnected. This is a convenience feature for Blueprints, often used on array pins.

UFUNCTION(BlueprintCallable)
void SomeColorWithoutRef(const FLinearColor& Color) {}
UFUNCTION(BlueprintCallable, meta=(AutoCreateRefTerm="Color"))
void SomeColorWithRef(const FLinearColor& Color) {}

UFUNCTION(meta=(BlueprintAutocast))

Internally calls SearchForAutocastFunction

Used only by static BlueprintPure functions from a Blueprint function library. A cast node will be automatically added for the return type and the type of the first parameter of the function.


UFUNCTION(meta=(BlueprintInternalUseOnly=true))

This function is an internal implementation detail, used to implement another function or node. It is never directly exposed in a Blueprint graph.


UFUNCTION(meta=(BlueprintProtected))

This function can only be called on the owning Object in a Blueprint. It cannot be called on another instance.


UFUNCTION(meta=(CallableWithoutWorldContext))

Used for BlueprintCallable functions that have a WorldContext pin to indicate that the function can be called even if its Class does not implement the GetWorld function.


UFUNCTION(meta=(CommutativeAssociativeBinaryOperator))

Indicates that a BlueprintCallable function should use the Commutative Associative Binary node. This node lacks pin names, but features an Add Pin button that creates additional input pins.


UFUNCTION(meta=(CustomStructureParam="abc"))

The listed parameters are all treated as wildcards. This specifier requires the UFUNCTION-level specifier, CustomThunk, which will require the user to provide a custom exec function. In this function, the parameter types can be checked and the appropriate function calls can be made based on those parameter types. The base UFUNCTION should never be called, and should assert or log an error if it is. To declare a custom exec function, use the syntax DECLARE_FUNCTION(execMyFunctionName) where MyFunctionName is the name of the original function.


UFUNCTION(meta=(DefaultToSelf))

For BlueprintCallable functions, this indicates that the Object property's named default value should be the self context of the node.


UFUNCTION(meta=(DeprecatedFunction))

Any Blueprint references to this function will cause compilation warnings telling the user that the function is deprecated. You can add to the deprecation warning message (for example, to provide instructions on replacing the deprecated function) using the DeprecationMessage metadata specifier.


UFUNCTION(meta=(DeprecationMessage="abc"))

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


UFUNCTION(meta=(DeterminesOutputType="abc"))

The return type of the function will dynamically change to match the input that is connected to the named parameter pin. The parameter should be a templated type like TSubClassOf or TSoftObjectPtr, where the function's original return type is X* or a container with X* as the value type, such as TArray<X*>.

UFUNCTION(BlueprintCallable, Category="Utilities", meta=(WorldContext="WorldContextObject", DeterminesOutputType="ActorClass", DynamicOutputParam="OutActors"))
static void GetAllActorsOfClass(const UObject* WorldContextObject, TSubclassOf<AActor> ActorClass, TArray<AActor*>& OutActors);

UFUNCTION(meta=(ExpandEnumAsExecs="abc"))

For BlueprintCallable functions, this indicates that one input execution pin should be created for each entry in the enum used by the parameter. The parameter must be of an enumerated type that has the UENUM tag.

UENUM()
enum class EAnimalType : uint8
{
  Cat,
  Dog,
  Rooster
};

UFUNCTION(BlueprintCallable, meta=(ExpandBoolAsExec="DidSucceed"))
static void SwitchAnimalByName(FString Name, EAnimalType& Animal);

UFUNCTION(meta=(ExpandBoolAsExecs="abc"))

Note that "ReturnValue" is a special

For BlueprintCallable functions, this indicates that one input execution pin should be created for each entry in the enum used by the parameter. The parameter must be of an enumerated type that has the UENUM tag.

UFUNCTION(BlueprintCallable, meta=(ExpandEnumAsExecs="ReturnValue"))
static bool IsAboveFreezing(float Temperature);
UFUNCTION(BlueprintCallable, meta=(ExpandEnumAsExecs="bFreezing"))
static void IsAboveFreezing(float Temperature, bool& bFreezing);

UFUNCTION(meta=(DynamicOutputParam="abc"))
UFUNCTION(BlueprintCallable, Category="Utilities", meta=(WorldContext="WorldContextObject", DeterminesOutputType="ActorClass", DynamicOutputParam="OutActors"))
static void GetAllActorsOfClass(const UObject* WorldContextObject, TSubclassOf<AActor> ActorClass, TArray<AActor*>& OutActors);

UFUNCTION(meta=(AllowPrivateAccess=true))

UFUNCTION(meta=((ParameterName=DefaultValue)="abc"))

Not sure how to describe this one. Technically it doesn't have a name. Use it to give a parameter a default value, separate to how C++ sassigns default values.

UFUNCTION(BlueprintCallable, meta=(Number="99"))
void DefaultParamInMeta(int32 Number);

UFUNCTION(BlueprintCallable)
void DefaultParamInCPP(int32 Number = 99);

UFUNCTION(BlueprintCallable, meta=(Number="1"))
void DefaultParamInBoth(int32 Number = 99);
UFUNCTION(BlueprintCallable, meta=(ComponentClass="ActorComponent"))
void DefaultTSubclassValue(TSubclassOf<UActorComponent> ComponentClass);
UFUNCTION(BlueprintCallable, meta=(RectColor="(R=0,G=1,B=0,A=1)"))
void DefaultStructValue(FLinearColor RectColor);

UFUNCTION(CallInEditor)

Causes a UFUNCTION with no parameters and no return value to be shown in the details panel of object instances.

Could be useful for adding helper functions to change the values on the selected instance. For example increasing the level of an enemy by changing their stats, or filling out default values using C++.

To reiterate, only works with functions that have no parameters, and return void. BlueprintCallable is not required. Only works on instances of the class. So Actors placed in a level, not on Blueprint classes.

This works as a flag in the main position, or as a boolean in the meta position. I would stick to the Main position just because there are more examples of this in the Unreal codebase.

This function can be called in the editor on selected instances via a button in the Details panel.

UFUNCTION(Category="Helper Functions", CallInEditor)
void AutofillData();
UFUNCTION(Category="Helper Functions", CallInEditor)
void ReticulateSplines();
UFUNCTION(Category="Helper Functions", CallInEditor)
void IncreaseLevel();
// This works
UFUNCTION(CallInEditor)
void MainPosition();
// This also works, but I wouldn't use it
UFUNCTION(meta=(CallInEditor=true))
void MetaPosition();

UFUNCTION(Category)

Specifies the category of the function when displayed in Blueprint editing tools. Define nested categories using the | operator.


UFUNCTION(meta=(Latent))

Indicates a latent action. Latent actions have one parameter of type FLatentActionInfo, and this parameter is named by the LatentInfo specifier.


UFUNCTION(meta=(LatentInfo="abc"))

For Latent BlueprintCallable functions indicates which parameter is the LatentInfo parameter.


UFUNCTION(meta=(NativeBreakFunc))

For BlueprintCallable functions, indicates that the function should be displayed the same way as a standard Break Struct node.


UFUNCTION(meta=(NotBlueprintThreadSafe))

Only valid in Blueprint function libraries. This function will be treated as an exception to the owning Class's general BlueprintThreadSafe metadata.


UFUNCTION(meta=(UnsafeDuringActorConstruction))

This function is not safe to call during Actor construction.


UFUNCTION(meta=(WorldContext="abc"))

Used by BlueprintCallable functions to indicate which parameter determines the World in which the operation takes place.


UFUNCTION(CustomThunk)

I'm still not very familiar with this but check out KismetArrayLibrary.h for an implementation that uses it.

The UnrealHeaderTool code generator will not produce a thunk for this function; it is up to the user to provide one with the DECLARE_FUNCTION or DEFINE_FUNCTION macros.


UFUNCTION(Exec)

Unreal has an in-game cheat console, accessed with the tilde key by default. It's great for adding debug commands and cheats. Any UFUNCTION marked with Exec can be executed there and provided with parameters.

The classes that are supported by Exec by default are:

  • UWorld
  • UPlayerInput
  • UGameInstance
  • APlayerController
  • APawn
  • AHUD
  • AGameModeBase
  • ACheatManager
  • AGameStateBase
  • APlayerCameraManager

The function can be executed from the in-game console. Exec commands only function when declared within certain Classes.


UFUNCTION(meta=(AdvancedDisplay))

The comma-separated list of parameters will show up as advanced pins (requiring UI expansion).

Replace N with a number, and all parameters after the Nth will show up as advanced pins (requiring UI expansion). For example, 'AdvancedDisplay=2' will mark all but the first two parameters as advanced).


UFUNCTION(meta=(CompactNodeTitle="abc"))

Indicates that a BlueprintCallable function should display in the compact display mode, and provides the name to display in that mode.

UFUNCTION(BlueprintPure)
FString WithoutCompactTitle(bool InBool);

UFUNCTION(BlueprintPure, meta=(CompactNodeTitle = ":)"))
FString WithCompactTitle(bool InBool);

UFUNCTION(meta=(DisplayName="abc"))

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


UFUNCTION(meta=(ReturnDisplayName="abc"))

Change the label on the return value from the default "Return Value" to the specified string.

UFUNCTION(BlueprintCallable, Category = "Doggy Daycare", Meta = (ReturnDisplayName = "Success"))
bool TryPetDog(const FName Name);

UFUNCTION(meta=(HidePin="abc"))

For BlueprintCallable functions, this indicates that the parameter pin should be hidden from the user's view. Only one pin per function can be hidden in this manner.


UFUNCTION(meta=(HideSelfPin))

Hides the "self" pin, which indicates the object on which the function is being called. The "self" pin is automatically hidden on BlueprintPure functions that are compatible with the calling Blueprint's Class. Functions that use the HideSelfPin Meta Tag frequently also use the DefaultToSelf Specifier.


UFUNCTION(meta=(ShortToolTip="abc"))

A short tooltip that is used in some contexts where the full tooltip might be overwhelming, such as the Parent Class Picker dialog.


UFUNCTION(meta=(ToolTip="abc"))

Overrides the automatically generated tooltip from code comments.


UFUNCTION(meta=(DevelopmentOnly))

Functions marked as DevelopmentOnly will only run in Development mode. This is useful for functionality like debug output, which is expected not to exist in shipped products.


UFUNCTION(meta=(InternalUseParam="abc"))

Similar to HidePin, this hides the named parameter's pin from the user's view, and can only be used for one parameter per function.


UFUNCTION(meta=(KeyWords="abc"))

Specifies a set of keywords that can be used when searching for this function, such as when placing a node to call the function in a Blueprint Graph.


UFUNCTION(meta=(MaterialParameterCollectionFunction))

For BlueprintCallable functions, indicates that the material override node should be used.


UFUNCTION(Server)

The function is only executed on the server. Declares an additional function named the same as the main function, but with _Implementation added to the end, which is where code should be written. The autogenerated code will call the _Implementation method when necessary.


UFUNCTION(Client)

The function is only executed on the client that owns the Object on which the function is called. Declares an additional function named the same as the main function, but with _Implementation added to the end. The autogenerated code will call the _Implementation method when necessary.


UFUNCTION(NetMulticast)

The function is executed both locally on the server, and replicated to all clients, regardless of the Actor's NetOwner.


UFUNCTION(BlueprintAuthorityOnly)

This function will only execute from Blueprint code if running on a machine with network authority (a server, dedicated server, or single-player game).


UFUNCTION(WithValidation)

Declares an additional function named the same as the main function, but with _Validate added to the end. This function takes the same parameters, and returns a bool to indicate whether or not the call to the main function should proceed.


UFUNCTION(BlueprintCosmetic)

This function is cosmetic and will not run on dedicated servers.


UFUNCTION(Reliable)

The function is replicated over the network, and is guaranteed to arrive regardless of bandwidth or network errors. Only valid when used in conjunction with Client or Server.


UFUNCTION(Unreliable)

The function is replicated over the network but can fail due to bandwidth limitations or network errors. Only valid when used in conjunction with Client or Server.


UFUNCTION(ServiceRequest)

This function is an RPC (Remote Procedure Call) service request. This implies NetMulticast and Reliable.


UFUNCTION(ServiceResponse)

This function is an RPC service response. This implies NetMulticast and Reliable.


UFUNCTION(meta=(DataTablePin="abc"))

Metadata to identify an DataTable Pin. Depending on which DataTable is selected, we display different RowName options


UFUNCTION(meta=(SetParam="abc"))

Metadata to identify an DataTable Pin. Depending on which DataTable is selected, we display different RowName options


UFUNCTION(meta=(MapParam="abc"))

Metadata that flags TMap function parameters that will have their type determined at blueprint compile time


UFUNCTION(meta=(MapKeyParam))

Metadata that flags TMap function parameters that will have their key type determined at blueprint compile time


UFUNCTION(meta=(MapValueParam))

Metadata that flags TMap function parameter that will have their value type determined at blueprint compile time


UFUNCTION(meta=(Bitmask))

Metadata that identifies an integral property as a bitmask.


#Unreal #Specifiers

⚠️ **GitHub.com Fallback** ⚠️