Fix crash when scripting object gets deleted while it exists in NetworkReplicationHierarchy

This commit is contained in:
Wojtek Figat
2023-05-24 12:06:09 +02:00
parent 2c1f6e561a
commit 9986d62a28
2 changed files with 2 additions and 2 deletions

View File

@@ -110,7 +110,7 @@ void NetworkReplicationNode::Update(NetworkReplicationHierarchyUpdateResult* res
}
}
}
if (targetClients)
if (targetClients && obj.Object)
{
// Replicate this frame
result->AddObject(obj.Object, targetClients);

View File

@@ -18,7 +18,7 @@ API_STRUCT(NoDefault, Namespace = "FlaxEngine.Networking") struct FLAXENGINE_API
{
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkReplicationObjectInfo);
// The object to replicate.
API_FIELD() ScriptingObject* Object;
API_FIELD() ScriptingObjectReference<ScriptingObject> Object;
// The target amount of the replication updates per second (frequency of the replication). Constrained by NetworkManager::NetworkFPS.
API_FIELD() float ReplicationFPS = 60;
// The minimum distance from the player to the object at which it can process replication. For example, players further away won't receive object data.