-
Notifications
You must be signed in to change notification settings - Fork 142
[UNR-2887] Fix: Dynamic subobjects attached near actor creation would not be able to replicate their properties #1806
[UNR-2887] Fix: Dynamic subobjects attached near actor creation would not be able to replicate their properties #1806
Conversation
Corresponding JIRA ticket: https://improbableio.atlassian.net/browse/UNR-2887 |
@@ -538,7 +538,7 @@ void USpatialReceiver::ReceiveActor(Worker_EntityId EntityId) | |||
if (AActor* EntityActor = Cast<AActor>(PackageMap->GetObjectFromEntityId(EntityId))) | |||
{ | |||
UE_LOG(LogSpatialReceiver, Log, TEXT("Entity for actor %s has been checked out on the worker which spawned it or is a singleton linked on this worker. " | |||
"Entity id: $lld"), *EntityActor->GetName(), EntityId); | |||
"Entity id: %lld"), *EntityActor->GetName(), EntityId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by fix
if (ComponentId == It->component_id) | ||
{ | ||
Connection->SendComponentUpdate(EntityId, &(*It)); | ||
It.RemoveCurrent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No memory corruption?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RemoveCurrentSwap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have had to replace the entire code section, now it's kind of less readable. Suggestions welcome
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced back to using an iterator, because we want to preserve order.
By the way, I am pretty sure my previous early-resolving of dynamic subobjects breaks dynamic subobjects for which you turn replication on and off :( |
Description
Previously, if trying to create and attach a dynamic subobject to an actor near its creation point, the fields of the dynamic component would not replicate properly after initial creation.
The reason for this was that we were not setting component write ACLs properly for these subobjects. This was due to the change made earlier, to resolve dynamic components earlier, which caused the code trying to check if the subobject is dynamically attached to think it was not dynamically attached, since it has already been resolved. This is fixed by decoupling the writing of ACLs from the resolution of the dynamic object in
SpatialSender::CreateEntity
.Also a drive-by fix for $lld spam in logs.
Also a drive-by fix for authority queuing not checking which component we got authority over and potentially firing component updates for objects we did not have authority over.
Release note
This actually worked prior to the previous fix to dynamic subobjects (also in this RC), so I think no release note is necessary.
Tests
Augmented dynamic component tests: https://github.com/improbable/UnrealGDKEngineNetTest/pull/8.
Documentation
N/A
Primary reviewers
@improbable-valentyn @Vatyx