Why does my component dont move with my parent?

Hey I try learning unreal engine in combination with c++. I attached in c++ a staticmesh and boxcollision (root) components but in the editor the staticmesh component is like detached and wont move with the collision box. In addition the staticmesh component is under a white line. Has some one an idea what I did wrong and what this white line means?



1 Like

You create SM_Brick but don’t attach it to the root component, I think you need to call that manually.

SM_Brick->SetupAttachment(RootComponent);
2 Likes

Something else, but, you might want to mark your component UPROPERTYs as VisibleAnywhere instead of EditAnywhere, else you can create a few strange bugs in the BP editor.

This Actor / ActorComponent mix is also an exception that added ActorComponents do not have to be stored in UPROPERTY to be managed properly by the GC, because Actors reference their ActorComponents automatically. You can though if you want to.

2 Likes

Thank you Seda145 I applied both changes and now it works just fine. Thank you very much