# AttachRootComponentToActor crashes multiplayer game

**URL:** <https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515>\
**Category:** Character & Animation\
**Tags:** attach, scenecomponent, unreal-engine, question\
**Created:** [March 5, 2015, 11:44pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515 "2015-03-05T23:44:15Z")\
**Posts on this page:** 19\
**Page:** 3

<div class="post-metadata">

**Author:** ![RyroNZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyroNZ](https://forums.unrealengine.com/u/RyroNZ)\
**Post date:** [December 21, 2015, 7:38pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/41 "2015-12-21T19:38:18Z")

</div>

Hi , I am experiencing this same issue when I attempt to Attach an Actor at the start of the game with a Client. This is on 4.10.

 ![71463-untitled.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/0/5/1053cedfead940df7832789037a921079f8c728c.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [December 24, 2015, 9:47pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/42 "2015-12-24T21:47:13Z")

</div>

Hi ,

Would it be possible to take a look at your project? We can cross-reference what is happening with your project with what is happening in 's and see if that helps to pinpoint where things are going wrong. If you would like to provide your project privately, you can [send me a PM][1] on the forums.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [January 5, 2016, 11:16pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/43 "2016-01-05T23:16:27Z")

</div>

Hi ,

I did some more experimenting today with the sample project that you provided, and was unable to see the crash that we originally saw there. Would you be able to provide some updated steps that trigger the crash (either here or via forum PM).

, we have not heard back from you for a while. Would you be able to provide a sample project demonstrating the issue you are seeing so we can compare what is happening there directly with what is happening with the other sample project we have?

---

<div class="post-metadata">

**Author:** ![nkey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nkey](https://forums.unrealengine.com/u/nkey)\
**Post date:** [January 5, 2016, 11:50pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/44 "2016-01-05T23:50:59Z")

</div>

I could provide project with 100% (I hope) way to reproduce issue. I’ll uploading sources somewhere, will send you in PM.

UPDATE: done, check your PM on forum.

UPDATE2: It seems to get crash I need to detach on object first.

---

<div class="post-metadata">

**Author:** ![Pseudocorpus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pseudocorpus/32/453689_2.png) [@Pseudocorpus](https://forums.unrealengine.com/u/Pseudocorpus)\
**Post date:** [January 6, 2016, 2:18pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/45 "2016-01-06T14:18:52Z")

</div>

Hey ,

I have send you a PM with the current code and description. I am testing with 4.10

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [January 11, 2016, 8:33pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/46 "2016-01-11T20:33:49Z")

</div>

Hello everyone,

Thank you for the additional test projects that were provided. I have created a new ticket to continue investigating this issue (UE-25221). With the additional information that was provided, I am hopeful that we will be able to pinpoint what is going wrong.

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 17, 2016, 6:37am UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/47 "2016-01-17T06:37:54Z")

</div>

Hey everyone,

I’m getting the same problem.

, here is a simple say to reproduce the problem using the sample project (miniYag) i sent you for the network issue about file sharing between server and clients.

In the YagPlayerController.cpp, add the following lines around line 1430 (in the ServerSpawnObject function):

```
// TEST
// ATTACH TO PREVIOUS OBJECT
if (MyGameState && MyGameState->ObjectArray.Num() > 1)
{
	//SpawnedObject->AttachRootComponentTo(MyGameState->ObjectArray[FMath::Min(0, MyGameState->ObjectArray.Num() - 2)]->GetRootComponent());
	SpawnedObject->AttachRootComponentToActor(MyGameState->ObjectArray[FMath::Min(0, MyGameState->ObjectArray.Num() - 2)]);
}

```

They attach each newly spawned object to its predecessor in the object array maintained by the game state.

You then just have to add two objects to reproduce the problem.

When playing with only a server the attachment works well, but when using 2 players, you’ll get the crash.

Here is a video showing you everything:

I hope this helps.

Cheers

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [January 25, 2016, 7:38pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/48 "2016-01-25T19:38:21Z")

</div>

Hello everyone,

Thank you for the additional test cases and patience while we work on this issue. I just ran some tests using the sample projects that were provided in 4.11 Preview 3, and in most cases the Ensure was no longer getting triggered (one sample project got stuck when trying to open, though I don’t believe that is related to this particular issue). Would you be able to try your sample projects in Preview 3 and let us know if you happen to still see the Ensure?

, in your project in particular, a different (but similar) Ensure was triggered when ending PIE. This other Ensure we believe was corrected this past weekend.

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 28, 2016, 7:32pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/49 "2016-01-28T19:32:08Z")

</div>

Hey ,

Sorry for the delayed answer, i’m using the substance plugin which has still not been released for 4.11 preview so i had to debug the 4.10 version of the plugin for it to compile on 4.11.

So i ran some tests in 4.11 preview 4 and unfortunately the bug is still present for me.

I made a quick video to show you what i do:

Of course, please let me know if you need any more info.

Cheers

---

<div class="post-metadata">

**Author:** ![Pseudocorpus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pseudocorpus/32/453689_2.png) [@Pseudocorpus](https://forums.unrealengine.com/u/Pseudocorpus)\
**Post date:** [January 28, 2016, 9:01pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/50 "2016-01-28T21:01:39Z")

</div>

I tested Preview 4 and it all seems to work really well. This is going to be a great Update. Hope it stays that way, but I will re-open this thread if the error occurs again. Thank you so much. You are great. 🙂

---

<div class="post-metadata">

**Author:** ![uced](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@uced](https://forums.unrealengine.com/u/uced)\
**Post date:** [January 30, 2016, 11:05am UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/51 "2016-01-30T11:05:54Z")

</div>

Hey ,

I tried on a packaged game and it worked, even in 4.10.

So in short, on my side:

- it works well on packaged game even in 4.10
- It doesn’t work in PIE even in 4.11

Cheers

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b467b02b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b467b02b](https://forums.unrealengine.com/u/anonymous_user_b467b02b)\
**Post date:** [May 17, 2016, 2:29pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/52 "2016-05-17T14:29:23Z")

</div>

Hi,  
I have the same problem in a multiplayer Dedicated game, running on 4.11 latest. Both packed games and in PIE.

1. Detach item(actor) on server
2. Client freeze(could be up to 40 sec !!!) and stacktrace as below:

> 2016.04.26-12.57.56:270][947]LogOutputDevice:Warning:
> 
> Script Stack:  
> Actor.OnRep\_AttachmentReplication
> 
> [2016.04.26-12.57.56:994][947]LogStats: FPlatformStackWalk::StackWalkAndDump -  
> 0.723 s [2016.04.26-12.57.56:994][947]LogOutputDevice:Warning: === Handled error: ===
> 
> Ensure condition failed: !bRegistered  
> ||  
> AttachParent-\>AttachChildren.Contains(this)  
> [File:D:\BuildFarm\buildmachine\_++UE4+Release-4.11\Engine\Source\Runtime\Engine\Private\Components\SceneComponent.cpp]  
> [Line: 1655] Attempt to detach  
> SceneComponent ‘LootCollisionSphere’  
> owned by ‘Shotgun\_C\_3’ from  
> AttachParent ‘CharacterMesh0’ while  
> not attached. Stack:  
> UE4Editor-Core.dll!FWindowsPlatformStackWalk::StackWalkAndDump()  
> [d:\buildfarm\buildmachine\_++ue4+release-4.11\engine\source\runtime\core\private\windows\windowsplatformstackwalk.cpp:178]  
> UE4Editor-Core.dll!FDebug::EnsureFailed()  
> [d:\buildfarm\buildmachine\_++ue4+release-4.11\engine\source\runtime\core\private\misc\outputdevice.cpp:317]  
> UE4Editor-Core.dll!FDebug::OptionallyLogFormattedEnsureMessageReturningFalse()  
> [d:\buildfarm\buildmachine\_++ue4+release-4.11\engine\source\runtime\core\private\misc\outputdevice.cpp:441]  
> UE4Editor-Engine.dll!USceneComponent::DetachFromParen[2016.04.26-12.57.56:996][947]LogStats: SubmitErrorReport - 0.000 s  
> [2016.04.26-12.57.57:452][947]LogStats: SendNewReport - 0.455 s  
> [2016.04.26-12.57.57:452][947]LogStats: FDebug::EnsureFailed - 1.182 s

When i can initiate it from the client i always detach first on client, that seems to work. But the problem is when the server is the “Initiator”

Cheers

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [May 20, 2016, 8:19pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/53 "2016-05-20T20:19:52Z")

</div>

Hi State128,

Are you able to reproduce this issue in a new, clean project, or does it only happen in your project? Just to be sure, when you detach a component on the Server, are you making sure that when the client is notified to detach the component it isn’t turning around and telling the server that the component needs to be detached?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b467b02b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b467b02b](https://forums.unrealengine.com/u/anonymous_user_b467b02b)\
**Post date:** [May 25, 2016, 9:23am UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/54 "2016-05-25T09:23:16Z")

</div>

Hi, after a chat with you guys at Nordic Game i changed approach. I think it works well now. What I did when dropping an item is to kill the item and create a new item (as a pickup). Then it seems to work. It could be a problem when changing owner of the actor and detach the Component. Anyways, works for me now. Thanks for your attention.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d747dd04](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d747dd04](https://forums.unrealengine.com/u/anonymous_user_d747dd04)\
**Post date:** [July 4, 2016, 9:30am UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/55 "2016-07-04T09:30:04Z")

</div>

Hi there,

What is the status of this ticket?  
We are having an issue caused by the change in UE-19264:  
[https://udn.unrealengine.com/questions/301054/non-replicated-child-detaches-from-replicated-pare.html](https://udn.unrealengine.com/questions/301054/non-replicated-child-detaches-from-replicated-pare.html)

The issue is that, on the client, the parent’s replicated AttachChildren is first being updated via property replication and this is conflicting with the subsequent Detach/DetachFromParent code that expects to be the one that modifies AttachChildren.

Thanks

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b666e59e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b666e59e](https://forums.unrealengine.com/u/anonymous_user_b666e59e)\
**Post date:** [August 29, 2016, 8:39pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/56 "2016-08-29T20:39:37Z")

</div>

Hi,

Sorry for the delayed response. I checked the post that you linked, and it looks like someone else had already responded there. For the sake of everyone on this thread, the issue that you described is a known issue that was reported in [UE-26025](https://issues.unrealengine.com/issue/UE-26025). Unfortunately we do not have a solution for this issue at this time.

---

<div class="post-metadata">

**Author:** ![Paul\_Ripley](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Paul\_Ripley](https://forums.unrealengine.com/u/Paul_Ripley)\
**Post date:** [June 29, 2018, 9:17am UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/57 "2018-06-29T09:17:06Z")

</div>

Hi all,  
Did this ever get officially fixed? I’m having this problem in 4.19 with exactly the same callstack mentioned above.

It sporadically happens when attaching an actor to another in a multiplayer game - sometimes the clients fail the check in the attach code when the attachment is replicated.

There is another bug that has the same callstack, but a different description here :

> **[The Unreal Engine Issues and Bug Tracker](https://issues.unrealengine.com/issue/UE-40244)**
>
> Welcome to the Unreal Engine Issue and Bug Tracker. You can check the status of an issue and search for existing bugs. See latest bug fixes too.

It is marked as Resolved, Won’t Fix, and Backlogged simultaneously.

---

<div class="post-metadata">

**Author:** ![Elitic](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Elitic](https://forums.unrealengine.com/u/Elitic)\
**Post date:** [July 19, 2018, 10:59am UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/58 "2018-07-19T10:59:02Z")

</div>

I’m getting same error. UE4.19.2

```
LogOutputDevice: Error: Ensure condition failed: !bRegistered || GetAttachParent()->GetAttachChildren().Contains(this) [File:D:\Build\++UE4+Release-4.19+Compile\Sync\Engine\Source\Runtime\Engine\Private\Components\SceneComponent.cpp] [Line: 2009]
LogOutputDevice: Error: Attempt to detach SceneComponent 'StaticMesh' owned by 'Wheel01_BP_C_9' from AttachParent 'StaticMesh' while not attached.

```

I guess we need to find workaround as they are not going to fix…

---

<div class="post-metadata">

**Author:** ![Paul\_Ripley](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Paul\_Ripley](https://forums.unrealengine.com/u/Paul_Ripley)\
**Post date:** [July 19, 2018, 2:57pm UTC](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515/59 "2018-07-19T14:57:18Z")

</div>

It turned out my problem was a network race condition. I was letting UE4 replicate the attachment/detachment of actors, but also manually attaching/unattaching the same actors in response to replication notifies.  
Sometimes the rep notifies would get in first, and when UE4’s internal replication happened, things weren’t in the expected state.  
Just removing my manual attachment/detachment on remote clients fixed it for me.

[Previous page](https://forums.unrealengine.com/t/attachrootcomponenttoactor-crashes-multiplayer-game/309515.md?page=2)
