Contents of StaticMeshComponent disappear upon changing ChildActorComponent

Hello there!
UE 4.14.1
I’ve encountered a rather weird behaviour, i’m adding components to C++ pawn class like that:

.h (in protected:)

UPROPERTY(EditAnywhere, Category = "Config")
UStaticMeshComponent* shipMesh;
UPROPERTY(EditAnywhere, Category = "Config")
UChildActorComponent* weaponActorComponent;   

.cpp (in class constructor)

shipMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Config Mesh"));
shipMesh->SetSimulatePhysics(true);
RootComponent = shipMesh;

weaponActorComponent = CreateDefaultSubobject<UChildActorComponent>(TEXT("Config Weapon"));

Now, when i access blueprint derived from that class, set actual actor for UChildActorComponent and press compile (in blueprint) my shipMesh component becomes “empty”, mesh disappears together with all of the component settings. If i’ll attemt to use it in game, i’ll get a crash with shipMesh nullptr. Recompiling from engine (c++ or blueprint) or reseting back of UChildActorComponent to “none” - none of that reverts back shipMesh subobject to functional state. Removing UChildActorComponent from c++ class and restarting editor does though.
Interestingly enough if i create childActorComponent via “add component” in blueprint - it works fine.

Here’s my mesh component before changing UChildActorComponent's actor:

After:

just replicated this with absolutely minimalistic setup, basically only those lines of code that you can see in this question in code snippets, still the same issue, what the heck?

Hey Max Yari-

It sounds like the issue you’re having is related to another reported issue involving child actor components and data loss. You can find details about the reported issue here: Unreal Engine Issues and Bug Tracker (UE-40027) . If you feel this is not the issue you’re experiencing, please provide any additional information to help us investigate the issue separately.

Cheers

Doug Wilson

ok, it seems to be related to this: https://answers.unrealengine.com/questions/453513/relative-location-broken-for-c-created-component.html my child actor is actually created through c++ and has the same symproms as in that question. Attemp of adding it as child actor breaks bluepring as described above.

thanks for reply! Hm interesting, let me check that with empty c++ created actor, will it break stuff or not.

So, tested it, with empty cpp child actor it works fine, it does break as soon as i add staticMeshComponent to it. Breaks exactly as desctibed in linked bug report. Crap, any workaround or progress on that issue? Or i have no other option but to use purely blueprints? It seems to me that such a usage of child actors should be extremely common, so kind of strange that issue exists.

oh, got it, it’s a fairly recent issue. Ok, looking forward to see it elliminated, good luck with that and let me know if you need any project samples with this issue from me =)