Non replicated child detaches from replicated parent issue

Hello,

We’ve been hitting the ensureMsg in USceneComponent::DetachFromParent. Specifically, the assertion that AttachParent->AttachChildren.Contains(this).

This is because we are detaching a non replicated component from a replicated parent on both the client and the server.
The detachment on the server side causes the parent’s AttachChildren to be updated.
The parent’s AttachChildren is then replicated to the client.
After updating it’s AttachChildren, the client then performs the DetachFromParent some time later.
Since the client’s AttachChildren no longer contains the component, the assertion fails.

We can work around this issue for now but it would be great if this can be fixed and/or a note about this use case can be placed where the assertion is hit.

Many thanks

Hello,

It actually doesn’t matter if the child is replicated or not. I get the assertion if, for example, I detach a component on the server. By the time the client is performing the replicated detachment action in OnRep_AttachmentReplication, the parent component’s AttachChildren property has already been nullified.

Thanks

Hi Michael,

This is actually a known issue - UE-26025. We’d like to improve the functionality here and fix this use case. In general though, we recommend against modifying replicated properties on clients, since the server is likely to overwrite the value when it changes on the server. Since AttachChildren is replicated, unfortunately this also currently applies to attachment on the client.

Thanks for the response.