It seems that the “Weld Simulated Bodies” option on the AttachToActor function (same with AttachActorToActor) is not working at runtime.
Well. In fact, it seems that in C++, it would come from the “AttachRootComponentToActor” function.
In BP, if calling AttachActorToActor in the BeginPlay sequence, it will work properly and the “Weld Simulated Bodies” option will work as intended.
On the other hand, it you put it anywhere else, like on a key event, it will attach it but the bodies will not weld and the target will not have collisions (when the parent will still have).
I attempted to reproduce this in-house but I’m not getting the same results. I maybe setting it up incorrectly on my end. Would you be able to create a small test project that has the issue and upload it here?
The attachement code is contained in the level blueprint.
All attachements are done during the BeginPlay event.
Then the last one (the blocs on the left is you don’t move the camera) are attached on the first event tick event.
To test and have a reproduction of the behavior, just press simulate.
All the blocs will fall to the ground. Then select the blocs on the second column starting from the left whilst un-possessed and try to rotate them around the Y axis (green one).
You will notice that all the blocs have collisions on the right block.
You will also notice that the two blocs (which are one actor) on the left block have no collision.
Those last 2 are the ones being attached on runtime. And they are the one not having collision.
I deducted that the Weld Simulated bodies worked well in the begin play event or any construction script but would not work at runtime properly, leading to lose of collision on attached components.
I hope that this will help (and if an easy fix exists, please let me now as this would be of utmost importance for our project) and that this is not an intended behavior.
I was able to reproduce this with the project you provided. I wasn’t able to find a workaround so I’ve created JIRA UE-22122 and our developers will be investigating the issue further. We will post here with questions and/or updates as we have them.