Navigation
API > API/Plugins > API/Plugins/NetcodeUnitTest
UnitTask's are used to implement supporting code for UnitTest's, for handling complex behind-the-scenes setup prior to test execution (e.g. primarily for implementing game-specific server/client environment setup), which is shared between many unit tests, and which is better to abstract-away from visibility in unit tests themselves, for code clarity.
For example, some games require authentication negotiation before the game client can connect to a server, and this is the type of task that UnitTask's are designed for.
Unit tasks that are added to a unit test, must complete execution before the unit test itself can execute.
| Name | UUnitTask |
| Type | class |
| Header File | /Engine/Plugins/NetcodeUnitTest/NetcodeUnitTest/Source/NetcodeUnitTest/Classes/UnitTask.h |
| Include Path | #include "UnitTask.h" |
Syntax
UCLASS (Abstract)
class UUnitTask :
public UObject ,
public FUnitLogRedirect
Inheritance Hierarchy
- FUnitLogInterface → FUnitLogRedirect → UUnitTask
- UObjectBase → UObjectBaseUtility → UObject → UUnitTask
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UUnitTask
(
const FObjectInitializer& ObjectInitializer |
UUnitTask | UnitTask.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| UUnitTest | friend | UnitTask.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Attach
(
UUnitTest* InOwner |
Attach the task to a unit test | UnitTask.h | |
virtual void Cleanup() |
Cleanup the task state, after the task completes | UnitTask.h | |
EUnitTaskFlags GetUnitTaskFlags() |
Retrieves UnitTaskFlags | UnitTask.h | |
bool HasStarted() |
Whether or not the task has started | UnitTask.h | |
virtual bool IsTaskComplete() |
Whether or not the task has completed | UnitTask.h | |
virtual bool IsTickable() |
Must override in subclasses, that need ticking. | UnitTask.h | |
virtual void NetTick() |
Tick function that runs at a tickrate of ~60 fps, for interacting with netcode (high UnitTick tickrate, can lead to net buffer overflows) | UnitTask.h | |
virtual void NotifyAlterMinClient
(
FMinClientParms& Parms |
Gives UnitTask's an opportunity to alter the MinimalClient setup parameters | UnitTask.h | |
virtual void ResetTimeout
(
FString ResetReason, |
See UUnitTest::ResetTimeout | UnitTask.h | |
virtual void StartTask() |
Start executing the task | UnitTask.h | |
void TriggerFailure
(
FString Reason |
Triggers a failure for the UnitTask and owning UnitTest | UnitTask.h | |
virtual void UnitTick
(
float DeltaTime |
Events passed from the unit test Main tick function for the unit test | UnitTask.h | |
virtual void ValidateUnitTaskSettings() |
After attaching to a unit test, validate the unit task settings are compatible | UnitTask.h |