AttachTo in constructor

Hi,

I don’t know if this is a real bug or intended design, but using AttachTo inside the constructor may cause a lot of problems. In my case, I have a Billboard Component that I create and Attach to my root inside my class constructor. However this eventually causes a crash. The error I get says that the engine attempts to detach the Billboard Component from the Collision Cylinder but it’s not attached to anything.

I moved the Attach To to PostInitializeComponents. Currently I am getting the following warnings (but no crashes as of yet).

[2015.06.15-10.05.15:583][513]LogActor:Warning: Natively added component (Enemy_StaticBot_C_3.CollisionCylinder) was left unattached from the actor's root.
[2015.06.15-10.05.29:614][319]LogActor:Warning: Natively added component (Enemy_StaticBot_C_4.CollisionCylinder) was left unattached from the actor's root.
[2015.06.15-10.05.34:829][618]LogActorComponent: UnregisterComponent: (/Engine/Transient.CharMoveComp) Not registered. Aborting.
[2015.06.15-10.05.35:904][682]BlueprintLog: New page: Compile Enemy_StaticBot
[2015.06.15-10.05.35:953][682]LogActor:Warning: Natively added component (Enemy_StaticBot_C_0.CollisionCylinder) was left unattached from the actor's root.
[2015.06.15-10.05.35:956][682]LogActor:Warning: Natively added component (Enemy_StaticBot_C_1.CollisionCylinder) was left unattached from the actor's root.
[2015.06.15-10.05.35:958][682]LogUObjectGlobals:Warning: Guid is in use by CapsuleComponent /Game/Maps/World_0.World_0:PersistentLevel.Enemy_StaticBot_2.CollisionCylinder and CapsuleComponent /Game/Maps/World_0.World_0:PersistentLevel.Enemy_StaticBot_C_1.CollisionCylinder, which should never happen in the editor but could happen at runtime with duplicate level loading or PIE
[2015.06.15-10.05.35:958][682]LogUObjectGlobals:Warning: Guid is in use by ArrowComponent /Game/Maps/World_0.World_0:PersistentLevel.Enemy_StaticBot_2.Arrow and ArrowComponent /Game/Maps/World_0.World_0:PersistentLevel.Enemy_StaticBot_C_1.Arrow, which should never happen in the editor but could happen at runtime with duplicate level loading or PIE
[2015.06.15-10.05.35:958][682]LogUObjectGlobals:Warning: Guid is in use by CharacterMovementComponent /Game/Maps/World_0.World_0:PersistentLevel.Enemy_StaticBot_2.CharMoveComp and CharacterMovementComponent /Game/Maps/World_0.World_0:PersistentLevel.Enemy_StaticBot_C_1.CharMoveComp, which should never happen in the editor but could happen at runtime with duplicate level loading or PIE
[2015.06.15-10.05.35:958][682]LogUObjectGlobals:Warning: Guid is in use by SkeletalMeshComponent /Game/Maps/World_0.World_0:PersistentLevel.Enemy_StaticBot_2.CharacterMesh0 and SkeletalMeshComponent /Game/Maps/World_0.World_0:PersistentLevel.Enemy_StaticBot_C_1.CharacterMesh0, which should never happen in the editor but could happen at runtime with duplicate level loading or PIE
[2015.06.15-10.05.35:958][682]LogUObjectGlobals:Warning: Guid is in use by BillboardComponent /Game/Maps/World_0.World_0:PersistentLevel.Enemy_StaticBot_2.LockGraphic and BillboardComponent /Game/Maps/World_0.World_0:PersistentLevel.Enemy_StaticBot_C_1.LockGraphic, which should never happen in the editor but could happen at runtime with duplicate level loading or PIE

Notably the “Collision Cylinder was left unattached”.

Hi Swiftle,

Can you provide the code files for this project so that I can attempt to look through and debug them? Without seeing the code itself, I can’t get much context as to what may be the issue. If it is a private project that you don’t wish to share with the public, you can also send a link to me on the forums through a private message. My forum username is

Hi,

Here are 2 .txt files that contain the .cpp and .h of Game Mode and my bot.link text

Hi Swiftle,

I was able to reproduce the crash and actually workaround it in a way I currently don’t understand. Try changing the UProperty specifiers for the declaration of this UBillboardComponent to EditAnywhere instead of EditDefaultsOnly. This immediately fixed the ensure I was getting along with the crash. As to why EditDefaultsOnly was causing this, I’m currently looking into that and I’ll get back to you as soon as possible.

Hope this helps!

We’re still unsure of why exactly this issue is occurring but a bug has been put into our database for the issue. For your reference, the bug number is UE-17400.

Have a nice day,

Hi ,

Thanks for your assistance.