Crash when loading child actor component in packaged game

Hi, my project have same problem. I’m too using child actor inside character and set it like yours:

TrayComponent->SetChildActorClass(AYagUIBranchMain::StaticClass());

As workaround I found that if I remove setting ChildActorClass from native code, and set it from blueprint of my Character - it will not crash anymore.

Hey !

Since 4.16 i get a crash in the packaged game with the following error (problem still occuring in 4.16.1):

[2017.06.03-06.43.04:997][  0]LogWindows:Error: Fatal error: [File:D:\Build\++UE4+Release-4.16+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading.cpp] [Line: 3095] 
[2017.06.03-06.43.04:997][  0]LogWindows:Error: YagUIBranchMain /Game/Yag/Game/BP_YagDefaultPawn.Default__BP_YagDefaultPawn_C:TrayComponent.TrayComponent_YagUIBranchMain_CAT was found in memory and is an export but does not have all load flags.

TrayComponent is a child actor component in the default pawn for the player controller (AGameMode::DefaultPawnClass)

YagDefaultPawn inherits from APawn:

class YAG_API AYagDefaultPawn : public APawn

And here is how TrayComponent is defined:

// YagDefaultPawn.h
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Yag)
	UChildActorComponent* TrayComponent;

----------------------------------------------------------------

// YagDefaultPawn constructor:
// TrayComponent
TrayComponent = ObjectInitializer.CreateDefaultSubobject<UChildActorComponent>(this, TEXT("TrayComponent"));
TrayComponent->DetachFromComponent(FDetachmentTransformRules::KeepWorldTransform);
TrayComponent->SetChildActorClass(AYagUIBranchMain::StaticClass());
TrayComponent->SetWorldRotation(FRotator(0.f));
TrayComponent->SetRelativeScale3D(FVector(4.f));
TrayComponent->SetIsReplicated(false);

AYagUIBranchMain is a very complex object (lots of components and it loads a lot of object libraries).

Everything works fine when playing in the editor (PIE and standalone are OK).

I get the crash only when trying to launch the packaged game.

In 4.15 and previous versions, everything worked well even in the packaged game. Crash in packaged game came with 4.16.

I enclose the full log here.

Thanks for your help^^
link text
Cedric

Hi, I’m having the same problem, did you figure out what was going wrong?

Hello ,

Have you attempted moving this ChildComponent to a fresh project to see if it alone is causing the problem? When looking up that message you received in the source code, I found that this message is brand new to 4.16 so it’s possible that there is a new check in place and I’ll need to ask the developer who implemented it about this. I’ll let you know when I have more information.

Edit: Before that however, could you provide the full log for the packaging process itself? There could be some information in a warning or something of the sort that could point to what exactly is causing this.

Hey Matthew,

Apologies for my delayed answer, quite busy with work currently !

Here are the packaging logs.

Cheers

Cedric
link text

Hey Ninjed,

Thanks for the tip but unfortunately it didn’t work for me, as soon as i comment the line, the editor crashes on launch.

Thanks though !

Cedric

Try do this in following order:

  1. Load in editor(before commenting line) and set ChildActorClass to null and save Pawn BP.
  2. Close editor and comment that line
  3. After rebuild project load editor again and set ChildActorClass to that class again

Maybe this time it helps

Nicely done my friend, thanks a lot !

I pushed your logic further and put the line in PostInitializeComponents(), it works well and no BP code involved.

So the packaging problem seems to come from SetChildActorClass being called in the constructor.

This is the first time i am able to launch my packaged game in 4.16 and strangely enough, it launches straight in full screen. Is that a new feature ?

Anyway, thanks again Nynjed for this workaround, at least and at last i can work on my network problems again :slight_smile:

Cheers

Cedric

I’m glad that you found a workaround. I just put in a bug for another issue that seems like it could be related to this. The reproduction is different but since blueprint nativization turns the blueprint logic into code, it’s most likely the same issue. Please take a look at this post for further information. The workaround seems similar as well.

Hello Matthew! I’ve encountered similar bug on 4.19 without nativization.
Here’s my code:

ChildCameraComponent = CreateDefaultSubobject<UChildActorComponent>(TEXT("CharBarCamera"));
ChildCameraComponent->SetChildActorClass(ABarCamera::StaticClass());
ChildCameraComponent->SetupAttachment(SpringArmComp);

If I do it in Pawn constructor only packaged game crashes, but if I try to move this logic to postinitialization (pre init and init as well), my code triggers break points at data table load. The data table contains refs to my Pawns. I do not use nativization.