Packaged game crashes

Hi,

My game works fine in the editor (even when launched as a standalone game).

But when i package it, i get a crash with a message pointing to those lines in my code:

// Dice declaration
static ConstructorHelpers::FObjectFinder<UBlueprint> BP_d4Object(TEXT("Blueprint'/Game/dice/D4_Dice_BP.D4_Dice_BP'"));
BP_d4 = (UClass*)BP_d4Object.Object->GeneratedClass;

They are in the constructor of a ACharacter derived class, nothing fancy.

The crash reporter says the last line is guilty of access violation.

I guess somehow the object can’t be reached in packaged game, while it’s there in the editor.

But then what can i do ?

BTW im in 4.5 and it’s the first time i try to package.

Thanks

Cedric

Maybe those lines are not guilty: i tried to comment them and i get a crash pointing in some other line in the constructor:

	CharacterMovement->SetMovementMode(MOVE_Falling, 0);

This time, there isn’t any BP involved, it’s a safe line (at least i hope), but the error is the same (access violation), only with a different line number.

By the way, this is my default class pawn in case it’s important: i suppose it’s loaded in memory early in the game ? Could all those properties be not present at startup in the packaged game ?

I am no c++ (neither ue4) guru. Maybe those things should be in the beginplay function and not in the constructor ?

Should i leave in the constructor only what concerns the editor like BP stuff ?

I have aldready packaged BP games with no problem, this is my first c++ game, so maybe there are some packaging option that i missed ?

Cedric

oups, mistake in my previous post.

The access violation was pointing here:

static ConstructorHelpers::FObjectFinder<UBlueprint> BP_YagCharacterObject(TEXT("Blueprint'/Game/Character/BP_YagCharacter.BP_YagCharacter'"));
BP_YagCharacter = (UClass*)BP_YagCharacterObject.Object->GeneratedClass;

This time it’s in the playercontroller contructor.

So obviously there is a problem with objects generated from BP, which is a good news, at least it’s not random.

Is there anything special to check when packaging a game using this kind of code ?

Continuing my tests

Cedric

Ok, problem solved.

In the DefaultEditor.ini, i had this:

bDontLoadBlueprintOutsideEditor=true

and i replaced it by this:

bDontLoadBlueprintOutsideEditor=false

Not sure this is a good idea to let that one to true by default when creating a project.

Cedric