Navigation
API > API/Runtime > API/Runtime/Engine
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...
+-------------------+------------------------------------------------------------------------+ | | | +-------------------+------------------------------------------------------------------------+
| Name | UActorChannel |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/Engine/ActorChannel.h |
| Include Path | #include "Engine/ActorChannel.h" |
Syntax
UCLASS (Transient, CustomConstructor, MinimalAPI)
class UActorChannel : public UChannel
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UChannel → UActorChannel
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UActorChannel
(
const FObjectInitializer& ObjectInitializer |
Default constructor | Engine/ActorChannel.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~UActorChannel() |
Engine/ActorChannel.h |
Structs
| Name | Remarks |
|---|---|
| FPacketRepKeyInfo |
Enums
Protected
| Name | Remarks |
|---|---|
| ESubObjectDeleteFlag |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| ClassNetCacheSuffix | const FString | Engine/ActorChannel.h | |
| SubobjectRepKeyBufferSize | const int32 | Static size for SubobjectRepKeyMap. Allows us to resuse arrays and avoid dyanmic memory allocations. | Engine/ActorChannel.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Actor | TObjectPtr< AActor > | Variables. | Engine/ActorChannel.h | |
| ActorNetGUID | FNetworkGUID | Engine/ActorChannel.h | ||
| ActorReplicator | TSharedPtr< FObjectReplicator > | Engine/ActorChannel.h | ||
| bBlockChannelFailure | uint32 | Whether or not to block sending of NMT_ActorChannelFailure (for NetcodeUnitTest) | Engine/ActorChannel.h | |
| bClearRecentActorRefs | uint32 | 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 | Engine/ActorChannel.h | |
| bForceCompareProperties | uint32 | Engine/ActorChannel.h | ||
| bHoldQueuedExportBunchesAndGUIDs | uint32 | Engine/ActorChannel.h | ||
| bIsReplicatingActor | uint32 | Engine/ActorChannel.h | ||
| CreateSubObjects | TArray< TObjectPtr< UObject > > | Engine/ActorChannel.h | ||
| CustomTimeDilation | float | Engine/ActorChannel.h | ||
| LastUpdateTime | double | Engine/ActorChannel.h | ||
| PendingGuidResolves | TSet< FNetworkGUID > | Engine/ActorChannel.h | ||
| PendingObjKeys | TArray< int32 > | Keys pending in this bunch. | Engine/ActorChannel.h | |
| QueuedBunches | TArray< class FInBunch * > | Async networking loading support state. | Engine/ActorChannel.h | |
| QueuedBunchStartTime | double | Engine/ActorChannel.h | ||
| QueuedCloseReason | EChannelCloseReason | Engine/ActorChannel.h | ||
| QueuedExportBunches | TArray< class FOutBunch * > | Engine/ActorChannel.h | ||
| QueuedMustBeMappedGuidsInLastBunch | TArray< FNetworkGUID > | Engine/ActorChannel.h | ||
| RelevantTime | double | Variables. | Engine/ActorChannel.h | |
| ReplicationMap | TMap< UObject *, TSharedRef< FObjectReplicator > > | Engine/ActorChannel.h | ||
| SpawnAcked | uint32 | Engine/ActorChannel.h | ||
| SubobjectNakMap | TMap< int32, FPacketRepKeyInfo > | Maps packetId to keys in Subobject. | Engine/ActorChannel.h | |
| SubobjectRepKeyMap | TMap< int32, int32 > | Maps ObjID to the current RepKey. | Engine/ActorChannel.h |
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bActorIsPendingKill | uint32 | Tracks whether or not our actor has been seen as pending kill. | Engine/ActorChannel.h | |
| bIsForcedSerializeFromRPC | uint32 | Set to true if SerializeActor is called due to an RPC forcing the channel open | Engine/ActorChannel.h | |
| bSkipRoleSwap | uint32 | Engine/ActorChannel.h | ||
| bSuppressQueuedBunchWarningsDueToHitches | uint32 | Whether or not our NetDriver detected a hitch somewhere else in the engine. | Engine/ActorChannel.h | |
| ChannelSubObjectDirtyCount | uint16 | Engine/ActorChannel.h | ||
| QueuedBunchObjectReferences | TSet< TSharedRef< struct FQueuedBunchObjectReference > > | TODO: It would be nice to merge the tracking of these with PendingGuidResolves, to not duplicate memory, especially since both of these sets should be empty most of the time for most channels. | Engine/ActorChannel.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void BreakAndReleaseReferences() |
Release any references this channel is holding to UObjects and object replicators and mark it as broken. | Engine/ActorChannel.h | |
void CleanupReplicators
(
const bool bKeepReplicators |
Cleans up replicators and clears references to the actor class this channel was associated with. | Engine/ActorChannel.h | |
AActor * GetActor() |
UActorChannel interface and accessors. | Engine/ActorChannel.h | |
FObjectReplicator & GetActorReplicationData() |
Returns the replicator for the actor associated with this channel. Guaranteed to exist. | Engine/ActorChannel.h | |
const TArray< TObjectPtr< UObject > > & GetCreatedSubObjects () |
Engine/ActorChannel.h | ||
FNetFieldExportGroup * GetNetFieldExportGroupForClassNetCache
(
UClass* ObjectClass |
Finds the net field export group for a class net cache, if not found, creates one | Engine/ActorChannel.h | |
FNetFieldExportGroup * GetOrCreateNetFieldExportGroupForClassNetCache
(
const UObject* Object |
Finds (or creates) the net field export group for a class net cache, if not found, creates one | Engine/ActorChannel.h | |
bool GetSkipRoleSwap() |
Engine/ActorChannel.h | ||
bool IsActorReadyForReplication() |
Tells if the actor is ready to be replicated since he is BeginPlay or inside BeginPlay | Engine/ActorChannel.h | |
bool KeyNeedsToReplicate
(
int32 ObjID, |
Returns true if the given ObjID is not up to date with RepKey this implicitly 'writes' the RepKey to the current out bunch. | Engine/ActorChannel.h | |
| Engine/ActorChannel.h | |||
void PrepareForRemoteFunction
(
UObject* TargetObj |
If not queueing the RPC, prepare the channel for replicating the call. | Engine/ActorChannel.h | |
void ProcessBunch
(
FInBunch& Bunch |
Engine/ActorChannel.h | ||
bool ProcessQueuedBunches() |
Engine/ActorChannel.h | ||
| Queue a function bunch for this channel to be sent on the next property update. | Engine/ActorChannel.h | ||
| Reads the header of the content block and instantiates the subobject if necessary | Engine/ActorChannel.h | ||
UObject * ReadContentBlockPayload
(
FInBunch& Bunch, |
Reads content block header and payload | Engine/ActorChannel.h | |
bool ReadFieldHeaderAndPayload
(
UObject* Object, |
Reads property/function header and data blob from network stream | Engine/ActorChannel.h | |
void ReleaseReferences
(
bool bKeepReplicators |
Engine/ActorChannel.h | ||
int64 ReplicateActor () |
Replicate this channel's actor differences. | Engine/ActorChannel.h | |
bool ReplicateSubobject
(
UObject* Obj, |
Replicates given subobject on this actor channel | Engine/ActorChannel.h | |
bool ReplicateSubobject
(
UActorComponent* ActorChannel, |
Replicates an ActorComponent subobject. | Engine/ActorChannel.h | |
virtual bool ReplicateSubobjectCustom
(
UObject* Obj, |
Custom implementation for ReplicateSubobject when RepFlags.bUseCustomSubobjectReplication is true | Engine/ActorChannel.h | |
bool ReplicateSubobjectList
(
TArray< Type* >& ObjectList, |
Utility template for replicating list of replicated subobjects | Engine/ActorChannel.h | |
void SetChannelActor
(
AActor* InActor, |
Set this channel's actor to the given actor. | Engine/ActorChannel.h | |
void SetForcedSerializeFromRPC
(
bool bInFromRPC |
Engine/ActorChannel.h | ||
void SetSkipRoleSwap
(
const bool bShouldSkip |
Engine/ActorChannel.h | ||
void WriteContentBlockForSubObjectDelete
(
FOutBunch& Bunch, |
Writes the header for a content block specifically for deleting sub-objects | Engine/ActorChannel.h | |
void WriteContentBlockHeader
(
UObject* Obj, |
Writes the header for a content block of properties / RPCs for the given object (either the actor a subobject of the actor) | Engine/ActorChannel.h | |
int32 WriteContentBlockPayload
(
UObject* Obj, |
Writes header and payload of content block | Engine/ActorChannel.h | |
int32 WriteFieldHeaderAndPayload
(
FNetBitWriter& Bunch, |
Writes property/function header and data blob to network stream | Engine/ActorChannel.h |
Overridden from UChannel
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
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 | Engine/ActorChannel.h | |
| Append any export bunches | Engine/ActorChannel.h | ||
virtual void AppendMustBeMappedGuids
(
FOutBunch* Bunch |
Append any "must be mapped" guids to front of bunch. | Engine/ActorChannel.h | |
virtual bool CanStopTicking() |
Return true to indicate that this channel no longer needs to Tick() every frame. | Engine/ActorChannel.h | |
virtual int64 Close
(
EChannelCloseReason Reason |
Close the base channel. Returns how many bits were written to the send buffer | Engine/ActorChannel.h | |
virtual FString Describe() |
Describe the channel. | Engine/ActorChannel.h | |
virtual TArray< FOutBunch * > GetAdditionalRequiredBunches
(
const FOutBunch& OutgoingBunch, |
Returns any additional bunches (such as exports) needed by the passed-in OutgoingBunch | Engine/ActorChannel.h | |
virtual void Init
(
UNetConnection* InConnection, |
UChannel interface. | Engine/ActorChannel.h | |
virtual bool ReadyForDormancy
(
bool debug |
Returns true if channel is ready to go dormant (e.g., all outstanding property updates have been ACK'd) | Engine/ActorChannel.h | |
virtual void ReceivedBunch
(
FInBunch& Bunch |
Handle an incoming bunch. | Engine/ActorChannel.h | |
virtual void ReceivedNak
(
int32 NakPacketId |
Negative acknowledgment processing. | Engine/ActorChannel.h | |
virtual void SetClosingFlag() |
Set the closing flag. | Engine/ActorChannel.h | |
virtual void StartBecomingDormant () |
Puts the channel in a state to start becoming dormant. | Engine/ActorChannel.h | |
virtual void Tick() |
Handle time passing on this channel. | Engine/ActorChannel.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Serialize
(
FArchive& Ar |
Engine/ActorChannel.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TSharedRef< FObjectReplicator > & CreateReplicator
(
UObject* Obj, |
Creates a new object replicator. | Engine/ActorChannel.h | |
TSharedRef< FObjectReplicator > & CreateReplicator
(
UObject* Obj |
Creates a new object replicator or reuses a replicator if it was stored for dormancy in the Connection. | Engine/ActorChannel.h | |
void DestroyActorAndComponents
(
EChannelCloseReason Reason |
Engine/ActorChannel.h | ||
bool DoSubObjectReplication
(
FOutBunch& Bunch, |
Handle the replication of subobjects for this actor. | Engine/ActorChannel.h | |
TSharedRef< FObjectReplicator > & FindOrCreateReplicator
(
UObject* Obj, |
Convenience method for finding a replicator, and creating one if necessary, all at once. | Engine/ActorChannel.h | |
TSharedRef< FObjectReplicator > * FindReplicator
(
UObject* Obj |
Attempts to find a valid, non-dormant replicator for the given object. | Engine/ActorChannel.h | |
TSharedRef< FObjectReplicator > * FindReplicator
(
UObject* Obj, |
Attempts to find a valid, non-dormant replicator for the given object. | Engine/ActorChannel.h | |
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 | Engine/ActorChannel.h | |
bool ObjectHasReplicator
(
const TWeakObjectPtr< UObject >& Obj |
Engine/ActorChannel.h | ||
const TCHAR * ToString
(
UActorChannel::ESubObjectDeleteFlag DeleteFlag |
Engine/ActorChannel.h | ||
void WriteContentBlockForSubObjectDelete
(
FOutBunch& Bunch, |
Writes the header for a content block specifically for deleting sub-objects | Engine/ActorChannel.h |
Overridden from UChannel
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BecomeDormant() |
Closes the actor channel but with a 'dormant' flag set so it can be reopened | Engine/ActorChannel.h | |
virtual bool CleanUp
(
const bool bForDestroy, |
Cleans up channel structures and nulls references to the channel | Engine/ActorChannel.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static void AddReferencedObjects
(
UObject* InThis, |
Engine/ActorChannel.h | ||
static bool CanIgnoreDeprecatedReplicateSubObjects() |
Only returns true when calling ReplicateSubobjects() while we are trying to detect bad usage of the legacy function. | Engine/ActorChannel.h | |
static bool CanSubObjectReplicateToClient
(
const APlayerController* PlayerController, |
Engine/ActorChannel.h | ||
static void SetCurrentSubObjectOwner
(
UActorComponent* SubObjectOwner |
Engine/ActorChannel.h | ||
static void SetCurrentSubObjectOwner
(
AActor* SubObjectOwner |
Subobject Replication state | Engine/ActorChannel.h |