Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/UActorChannel
Overloads
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static void SetCurrentSubObjectOwner
(
AActor* SubObjectOwner |
Subobject Replication state | Engine/ActorChannel.h | |
static void SetCurrentSubObjectOwner
(
UActorComponent* SubObjectOwner |
Engine/ActorChannel.h |
SetCurrentSubObjectOwner(AActor *)
Description
Subobject Replication state
Concepts: ObjID - this is an arbitrary identifier given to us by the game code. RepKey - this is an idenifier for the current replicated state.
ObjID should be constant per object or "category". Its up to the game code. For example the game code could use 0 to determine if an entire array is dirty, then usen 1-N for each subobject in that list. Or it could have 5 arrays using 0-4, and then use 100*ArrayNum + idx for the items in the array.
RepKey should change as the subobject changes. Each time a subobject is marked dirty, its RepKey should change.
GameCode should call ::KeyNeedsToReplicate(ObjID, RepKey) to determine if it needs to replicate. For example: bool AMyActorClass::ReplicateSubobjects(UActorChannel *Channel, FOutBunch *Bunch, FReplicationFlags *RepFlags) { bool WroteSomething = false;
if (Channel->KeyNeedsToReplicate(0, ReplicatedArrayKey) ) // Does the array need to replicate? { for (int32 idx = 0; idx < ReplicatedSubobjects.Num(); ++idx ) { UMyActorSubobjClass *Obj = ReplicatedSubObjects[idx]; if (Channel->KeyNeedsToReplicate(1 + idx, Obj->RepKey)) {
WroteSomething |= Channel->ReplicateSubobject
return WroteSomething; }
void UMyActorSubobjClass::MarkDirtyForReplication() { this->RepKey++; MyOwningActor->ReplicatedArrayKey++; } Sets the owner of the next replicated subobjects that will be passed to ReplicateSubObject. The ActorComponent version will choose not to replicate the future subobjects if the component opted to use the registered list.
| Name | SetCurrentSubObjectOwner |
| Type | function |
| Header File | /Engine/Source/Runtime/Engine/Classes/Engine/ActorChannel.h |
| Include Path | #include "Engine/ActorChannel.h" |
| Source | /Engine/Source/Runtime/Engine/Private/DataChannel.cpp |
static void SetCurrentSubObjectOwner
(
AActor * SubObjectOwner
)
SetCurrentSubObjectOwner(UActorComponent *)
| Name | SetCurrentSubObjectOwner |
| Type | function |
| Header File | /Engine/Source/Runtime/Engine/Classes/Engine/ActorChannel.h |
| Include Path | #include "Engine/ActorChannel.h" |
| Source | /Engine/Source/Runtime/Engine/Private/DataChannel.cpp |
static void SetCurrentSubObjectOwner
(
UActorComponent * SubObjectOwner
)