You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Include documentation source in repository.
[CL 2489162 by Ben Marsh in Main branch]
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
||||
Availability:Public
|
||||
Title:Functions
|
||||
Crumbs:%ROOT%, Programming, Programming/UnrealArchitecture/Reference
|
||||
Description:Reference to creating and implementing functions for gameplay classes.
|
||||
Version: 4.5
|
||||
|
||||
[TOC(start:2)]
|
||||
|
||||
## 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](#FunctionSpecifiers).
|
||||
|
||||
UFUNCTION([specifier, specifier, ...], [meta(key=value, key=value, ...)])
|
||||
ReturnType FunctionName([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](Engine/Blueprints) system. Any
|
||||
`UFunction` declared using the `BlueprintCallable`, `BlueprintImplementableEvent`, or `BlueprintPure` specifiers (see [Function Specifiers](#FunctionSpecifiers) 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.
|
||||
|
||||
|
||||
### Function Specifiers
|
||||
|
||||
[INCLUDE:Programming/UnrealArchitecture/Reference/Functions/Specifiers#main(offset:2)]
|
||||
|
||||
### Function Parameter Specifiers
|
||||
|
||||
$ Out :
|
||||
Declares the parameter as being passed by reference allowing it to be modified by the function.
|
||||
$ Optional :
|
||||
With the optional keyword, you can make certain function parameters optional, as a convenience to the caller. The values for optional parameters which the caller does not specify depend on the function. For example, the `SpawnActor` function takes an optional location and rotation, which default to the location and rotation of the spawning Actor's root component. The default value of optional arguments can be specified by adding `= [value]`. For example: `function myFunc(optional int x = -1)`. In most cases, the default value for the type of variable, or zero (e.g. 0, false, "", none), is used when no values is passed to an optional parameter.
|
||||
|
||||
|
||||
## Function Implementations
|
||||
|
||||
Functions declared in the class header file are given definitions in the class source file.
|
||||
|
||||
## Delegates
|
||||
|
||||
[INCLUDE:Programming/UnrealArchitecture/Delegates#Overview]
|
||||
|
||||
See the [](Programming/UnrealArchitecture/Delegates) page for reference and usage information.
|
||||
|
||||
## Timers
|
||||
|
||||
[INCLUDE:Programming/UnrealArchitecture/Timers#Overview]
|
||||
|
||||
See the [](Programming\UnrealArchitecture\Timers) page for reference and usage information.
|
||||
Reference in New Issue
Block a user