Navigation
API > API/Runtime > API/Runtime/Engine
Class that is added by composition to any UObject that wants to be a replicated root object
This class is meant to provide an easy to use solution for quickly transforming any non-actor into an autonomous replicated object. But be aware it is not made to be the optimal solution if you intend to create alot of instances of the class using it. The memory overheaded of the variables in this class could be optimized away entirely if your class directly interacted with the Iris API in a similar way to what the adapter does. So for a more optimal solution, it is recommended to look at this class for inspiration and instead add the minimum necessary features you need to your own base class.
Important: The class that wants to be replicate autonomously must immplement a INetRootObjectFactoryExtension either in the class itself or as a standalone class able to retrieve this adapter and call FillRootObjectReplicationParams on it.
The expectation is then for the class to call at runtime in order:
1) InitAdapter() : Initialize the adapter so it knows who to replicate 2) Configure() : Configure the replication settings prior to starting replication 3) Provide the ULevel the UObject is a part of via SetAttachedLevel() or in StartReplication() 4) StartReplication() or RelevantWith() to add the object to the replication system 5) StopReplication() or RemoveRelevantWith when the object no longer should replicate 6) DeinitAdapter() before the object goes out of existing (optional)
| Name | FNetRootObjectAdapter |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Public/Net/Iris/ReplicationSystem/NetRootObjectAdapter.h |
| Include Path | #include "Net/Iris/ReplicationSystem/NetRootObjectAdapter.h" |
Syntax
class FNetRootObjectAdapter
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |||
FNetRootObjectAdapter
(
const FRootObjectSettings& Settings |
Net/Iris/ReplicationSystem/NetRootObjectAdapter.h |
Enums
Public
| Name | Remarks |
|---|---|
| ELevelValidation |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bIsAlwaysRelevant | bool | By default objects will be always relevant. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
| bIsInitialized | bool | Is the adapter correctly setup | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
| bIsNotRouted | bool | When true the object will not be relevant until an object it is replicating with is also relevant. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
| bIsReplicating | bool | Server only variable set when the object is part of the replication system | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
| bOnlyReplicateWhenLinked | bool | When true we automatically stop replication when the object does not have any objects to replicate with anymore. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
| DependentRootObjects | TMap< FObjectKey, uint32 > | Map of root objects and how many times we are dependent to each. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
| ExplicitNetFactoryName | FName | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | ||
| WeakLevel | TWeakObjectPtr< ULevel > | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | ||
| WeakReplicatedObject | FWeakObjectPtr | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Configure
(
const FRootObjectSettings& Settings |
Configure how the object will be replicated. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
void DeinitAdapter() |
Deinitialize the adapter and clear references | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
void FillRootObjectReplicationParams
(
const UE::Net::FRootObjectReplicationParamsContext& Context, |
Utility function that fills in the FRootObjectReplicationParams. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
| The netobject factory to use with this rootobject. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | ||
bool HasAttachedLevel() |
Server only: tells if the object is already attached to a level or not | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
void InitAdapter
(
UObject* ReplicatedObject |
Initialize the adapter with the object it will be responsible to replicate | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
bool IsAlwaysRelevant() |
Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | ||
bool IsInitialized() |
Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | ||
bool IsNotRouted() |
Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | ||
bool IsReplicating() |
Server only: tells if the object was added to the replication system or not | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
void RelevantWith
(
const UObject* OtherReplicatedObject |
Start replicating the object but make it relevant only via another replicated object. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
void RemoveRelevantWith
(
const UObject* OtherReplicatedObject |
Remove the relevancy dependency between our object and another replicated object. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
void SetAttachedLevel
(
ULevel* Level, |
Every object needs to be assigned to a ULevel to know which UWorld->ReplicationSystem it will be added to. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
void SetNetFactoryName
(
FName InFactoryName |
Set to use a netobject factory different from the default. Must be set before replication starts. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
void StartReplication
(
ULevel* Level |
Start replicating the object. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h | |
void StopReplication() |
Stop replicating the object. | Net/Iris/ReplicationSystem/NetRootObjectAdapter.h |