Vous êtes sur la page 1sur 4

UFUNCTION

FunctionDeclaration
UFUNCTION()Specifiers
BlueprintAuthorityOnly
BlueprintCallable
BlueprintCosmetic
BlueprintImplementableEvent
BlueprintNativeEvent
BlueprintPure
Category
Client
CustomThunk
Exec
NetMulticast
Reliable
Server
Unreliable
MetaSpecifiers
BlueprintInternalUseOnly
BlueprintProtected
DeprecatedFunction
DeprecationMessage
UnsafeDuringActorConstruction



UFUNCTION
https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Functions/
index.html
Function Declaration
Functions can exist in two basic forms: a regular C++ function or a UFunction. Both C++
functions and UFunctions are declared in the .h class header file. C++ functions are declared
using the standard C++ syntax for declaring a function. UFunctions use a specialized syntax
that allows additional information about the function to be specified in the declaration
through the use of Function Specifiers.

UFUNCTION([specifier,specifier,...],[meta(key=value,key=value,...)])
ReturnTypeFunctionName([Parameter,Parameter,...])

UFunctions behave the same as C++ functions in that they have a C++ implementation, can
be called from within C++ code, and can contain calls to other C++ functions or UFunctions
within their function bodies. UFunctions differ in a few areas, however. For instance, they
can be called or overridden from within the Blueprint Visual Scripting system. Any UFunction
declared using the BlueprintCallable, BlueprintImplementableEvent, orBlueprintPure specifiers
(see Function Specifiers below for more details) will be exposed to Blueprints. UFunctions can
also be assigned as delegates within the default properties of a class. This technique is
commonly used to bind input actions or axes to functions in Input classes. UFunctions are
also used as replication callbacks; meaning the UFunction will be called when the variable it is
associated with changes and is replicated across the network.UFunctions are also the only
type of function that can be declared as an exec function allowing them to be called by the
player from the in-game console during play.

UFUNCTION() Specifiers
BlueprintAuthorityOnly
This function will not execute from blueprint code if running on something without network
authority.
BlueprintCallable
The function can be executed in a Blueprint or Level Blueprint graph.
BlueprintCosmetic
This function is cosmetic and will not run on dedicated servers.
BlueprintImplementableEvent
The function can be overridden in a Blueprint or Level Blueprint graph.
BlueprintNativeEvent
This function is designed to be overridden by a Blueprint, but also has a native
implementation. Provide a body named [FunctionName]_Implementation instead of
[FunctionName]; the autogenerated code will include a thunk that calls the implementation
method when necessary.
BlueprintPure
The function does not affect the owning object in any way and can be executed in a
Blueprint or Level Blueprint graph.
Category
Specifies the category of the function when displayed in Blueprint editing tools.
*Usage:Category=CategoryNameorCategory="MajorCategory,SubCategory"
Client
The function is only executed on the client that owns the Object the function belongs to.
Provide a body named [FunctionName]_Implementation instead of [FunctionName]; the
autogenerated code will include a thunk that calls the implementation method when
necessary.
CustomThunk
The UnrealHeaderTool code generator will not produce a execFoo thunk for this function; it is
up to the user to provide one.
Exec
The function can be executed from the in-game console. Exec commands only function when
declared within certain class.
NetMulticast
This function is both executed locally on the server and replicated to all clients, regardless of
the Actor's NetOwner.
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.
Server
The function is only executed on the server. Provide a body named
[FunctionName]_Implementation instead of [FunctionName]; the autogenerated code will
include a thunk that calls the implementation method when necessary.
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.
Meta Specifiers
BlueprintInternalUseOnly
This function is an internal implementation detail, used to implement another function or
node. It is never directly exposed in a graph.
BlueprintProtected
This function can only be called on 'this' in a blueprint. It cannot be called on another
instance.
DeprecatedFunction
This function is deprecated, any blueprint references to it cause a compilation warning.
DeprecationMessage
Supplies the custom message to use for deprecation.
UnsafeDuringActorConstruction
This function is not safe to call during Actor construction.