UActorChannel

A channel for exchanging actor and its subobject's properties and RPCs.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/ActorChannel.h

Include

#include "Engine/ActorChannel.h"

Syntax

class UActorChannel : public UChannel

Remarks

A channel for exchanging actor and its subobject's properties and RPCs.

ActorChannel manages the creation and lifetime of a replicated actor. Actual replication of properties and RPCs actually happens in FObjectReplicator now (see DataReplication.h).

An ActorChannel bunch looks like this:

+-------------------+------------------------------------------------------------------------+ | SpawnInfo | (Spawn Info) Initial bunch only | | -Actor Class | -Created by ActorChannel | | -Spawn Loc/Rot | | | NetGUID assigns | | | -Actor NetGUID | | | -Component NetGUIDs | | +-------------------+------------------------------------------------------------------------+ | | | +-------------------+------------------------------------------------------------------------+ | NetGUID ObjRef | (Content chunks) x number of replicating objects (Actor + any components) | | | -Each chunk created by its own FObjectReplicator instance. | +-------------------+------------------------------------------------------------------------+ | | |

Properties...

RPCs...

+-------------------+------------------------------------------------------------------------+ | </End> | | +-------------------+------------------------------------------------------------------------+

Variables

Name Description

Public variable

AActor *

 

Actor

Variables.

Public variable

FNetworkGUID

 

ActorNetGUID

Public variable

TSharedPtr< FOb...

 

ActorReplicator

Public variable

bool

 

bBlockChannelFailure

Whether or not to block sending of NMT_ActorChannelFailure (for NetcodeUnitTest)

Public variable

uint32: 1

 

bClearRecentActorRefs

Whether we should nullptr references to this channel's Actor in other channels' Recent data when this channel is closed set to false in cases where the Actor can't become relevant again (e.g. destruction) as it's unnecessary in that case

Public variable

uint32: 1

 

bForceCompareProperties

Public variable

bool

 

bHoldQueuedExportBunchesAndGUIDs

Public variable

uint32: 1

 

bIsReplicatingActor

Public variable

TArray< UObject...

 

CreateSubObjects

Public variable

float

 

CustomTimeDilation

Public variable

double

 

LastUpdateTime

Public variable

TSet< FNetworkG...

 

PendingGuidResolves

Public variable

TArray< int32 >

 

PendingObjKeys

Keys pending in this bunch.

Public variable

TArray< class F...

 

QueuedBunches

Async networking loading support state.

Public variable

double

 

QueuedBunchStartTime

Public variable

EChannelCloseRe...

 

QueuedCloseReason

Public variable

TArray< class F...

 

QueuedExportBunches

Public variable

TArray< FNetwor...

 

QueuedMustBeMappedGuidsInLastBunch

Public variable

double

 

RelevantTime

Variables.

Public variable

TMap< UObject &...

 

ReplicationMap

Public variable

uint32: 1

 

SpawnAcked

Public variable

TMap< int32, FP...

 

SubobjectNakMap

Maps packetId to keys in Subobject.

Public variable

TMap< int32, in...

 

SubobjectRepKeyMap

Maps ObjID to the current RepKey.

Constructors

Name Description

Public function

UActorChannel

(
    const FObjectInitializer& ObjectIn...
)

Default constructor

Destructors

Name Description

Public function

~UActorChannel()

Functions

Name Description

Public function Static

void

 

AddReferencedObjects

(
    UObject* InThis,
    FReferenceCollector& Collector
)

Public function

void

 

CleanupReplicators

(
    const bool bKeepReplicators
)

Cleans up replicators and clears references to the actor class this channel was associated with.

Protected function

void

 

DestroyActorAndComponents()

Protected function

TSharedRef< ...

 

FindOrCreateReplicator

(
    UObject* Obj,
    bool* bOutCreated
)

Public function

AActor *

 

GetActor()

UActorChannel interface and accessors.

Public function

FObjectRepli...

 

GetActorReplicationData()

Returns the replicator for the actor associated with this channel. Guaranteed to exist.

Public function

FNetFieldExp...

 

GetNetFieldExportGroupForClassNetCache

(
    UClass* ObjectClass
)

Finds the net field export group for a class net cache, if not found, creates one

Public function

FNetFieldExp...

 

GetOrCreateNetFieldExportGroupForClassNetCache

(
    const UObject* Object
)

Finds (or creates) the net field export group for a class net cache, if not found, creates one

Public function Const

bool

 

GetSkipRoleSwap()

Public function

bool

 

KeyNeedsToReplicate

(
    int32 ObjID,
    int32 RepKey
)

Returns true if the given ObjID is not up to date with RepKey this implicitly 'writes' the RepKey to the current out bunch.

Protected function

void

 

MoveMappedObjectToUnmapped

(
    const UObject* Object
)

Unmap all references to this object, so that if later we receive this object again, we can remap the original references

Public function Virtual

void

 

NotifyActorChannelOpen

(
    AActor* InActor,
    FInBunch& InBunch
)

Protected function Const

bool

 

ObjectHasReplicator

(
    const TWeakObjectPtr< UObject >& O...
)

Public function

void

 

PrepareForRemoteFunction

(
    UObject* TargetObj
)

If not queueing the RPC, prepare the channel for replicating the call.

Public function

void

 

ProcessBunch

(
    FInBunch& Bunch
)

Public function

bool

 

ProcessQueuedBunches()

Public function

void

 

QueueRemoteFunctionBunch

(
    UObject* CallTarget,
    UFunction* Func,
    FOutBunch& Bunch
)

Queue a function bunch for this channel to be sent on the next property update.

Public function

UObject *...

 

ReadContentBlockHeader

(
    FInBunch& Bunch,
    bool& bObjectDeleted,
    bool& bOutHasRepLayout
)

Reads the header of the content block and instantiates the subobject if necessary

Public function

UObject *...

 

ReadContentBlockPayload

(
    FInBunch& Bunch,
    FNetBitReader& OutPayload,
    bool& bOutHasRepLayout
)

Reads content block header and payload

Public function Const

bool

 

ReadFieldHeaderAndPayload

(
    UObject* Object,
    const FClassNetCache* ClassCac...,
    FNetFieldExportGroup* NetField...,
    FNetBitReader& Bunch,
    const FFieldNetCache** Out...,
    FNetBitReader& OutPayload
)

Reads property/function header and data blob from network stream

Public function

int64

 

ReplicateActor()

Replicate this channel's actor differences.

Public function

bool

 

ReplicateSubobject

(
    UObject* Obj,
    FOutBunch& Bunch,
    const FReplicationFlags& RepFlags
)

Subobject Replication state

Public function

bool

 

ReplicateSubobjectList

(
    TArray< Type* >& ObjectList,
    FOutBunch& Bunch,
    const FReplicationFlags& RepFlags
)

Utility template for replicating list of replicated subobjects

Public function

void

 

SetChannelActor

(
    AActor* InActor,
    ESetChannelActorFlags Flags
)

Set this channel's actor to the given actor.

Public function

void

 

SetSkipRoleSwap

(
    const bool bShouldSkip
)

Public function

void

 

WriteContentBlockForSubObjectDelete

(
    FOutBunch& Bunch,
    FNetworkGUID& GuidToDelete
)

Writes the header for a content block specifically for deleting sub-objects

Public function

void

 

WriteContentBlockHeader

(
    UObject* Obj,
    FNetBitWriter& Bunch,
    const bool bHasRepLayout
)

Writes the header for a content block of properties / RPCs for the given object (either the actor a subobject of the actor)

Public function

int32

 

WriteContentBlockPayload

(
    UObject* Obj,
    FNetBitWriter& Bunch,
    const bool bHasRepLayout,
    FNetBitWriter& Payload
)

Writes header and payload of content block

Public function

int32

 

WriteFieldHeaderAndPayload

(
    FNetBitWriter& Bunch,
    const FClassNetCache* ClassCac...,
    const FFieldNetCache* FieldCac...,
    FNetFieldExportGroup* NetField...,
    FNetBitWriter& Payload,
    bool bIgnoreInternalAck
)

Writes property/function header and data blob to network stream

Overridden from UChannel

Name Description

Public function Virtual

void

 

AddedToChannelPool()

Notification that this channel has been placed in a channel pool and needs to reset to its original state so it can be used again like a new channel

Public function Virtual

void

 

AppendExportBunches

(
    TArray< FOutBunch* >& OutExpo...
)

Append any export bunches

Public function Virtual

void

 

AppendMustBeMappedGuids

(
    FOutBunch* Bunch
)

Append any "must be mapped" guids to front of bunch.

Protected function Virtual

void

 

BecomeDormant()

Closes the actor channel but with a 'dormant' flag set so it can be reopened

Public function Virtual Const

bool

 

CanStopTicking()

Return true to indicate that this channel no longer needs to Tick() every frame.

Protected function Virtual

bool

 

CleanUp

(
    const bool bForDestroy,
    EChannelCloseReason CloseReason
)

Cleans up channel structures and nulls references to the channel

Public function Virtual

int64

 

Close

(
    EChannelCloseReason Reason
)

Close the base channel. Returns how many bits were written to the send buffer

Public function Virtual

FString

 

Describe()

Describe the channel.

Public function Virtual

void

 

Init

(
    UNetConnection* InConnection,
    int32 InChIndex,
    EChannelCreateFlags CreateFlags
)

UChannel interface.

Public function Virtual

bool

 

ReadyForDormancy

(
    bool debug
)

Returns true if channel is ready to go dormant (e.g., all outstanding property updates have been ACK'd)

Public function Virtual

void

 

ReceivedBunch

(
    FInBunch& Bunch
)

Handle an incoming bunch.

Public function Virtual

void

 

ReceivedNak

(
    int32 NakPacketId
)

Negative acknowledgment processing.

Public function Virtual

void

 

SetClosingFlag()

Set the closing flag.

Public function Virtual

void

 

StartBecomingDormant()

Puts the channel in a state to start becoming dormant.

Public function Virtual

void

 

Tick()

Handle time passing on this channel.

Overridden from UObject

Name Description

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

Handles reading, writing, and reference collecting using FArchive.

Classes

Name

Description

Public struct

FPacketRepKeyInfo

Constants

Name

Description

ClassNetCacheSuffix

SubobjectRepKeyBufferSize

Static size for SubobjectRepKeyMap. Allows us to resuse arrays and avoid dyanmic memory allocations.

Deprecated Functions

Name Description

Public function

int64

 

SetChannelActorForDestroy

(
    FActorDestructionInfo* Destruc...
)

Use UNetworkDriver::SendDestructionInfo instead.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss