Player always returns null on updated project

I am copying this from the answer hub because i am starting to get desperate…

Recently i upgraded my game from 4.7 to 4.16, after fixing most of the code i got the project running, i tried to package the game and it would make a process but never show an actual window, i found that the line of code that was hanging the process was this one:

  1. static ConstructorHelpers::FClassFinder<APawn> PlayerPawnClassFinder(TEXT("/Game/Blueprints/MainCharacter/test"));

That line of code is in the gamemode class, it fetches the class that you want to set for the game’s default pawn.

Moving on… i tried to work around this by making a blueprint derived from my game mode and setting my pawn directly on the blueprint, this works fine in the editor as did the above line of code, but when you try compile in “debugGame” or “development” it crashes every time because the playerCharacter is null.

I even tried to make a new blueprint derived directly from the paper2Dcharacter, just to see if it was something in my code but the result was the same, the only thing that work to set a defaultPawn that doesnt crash in “debugGame”, “development” and i assume packagaed games is if i set the defaultPawn like this:

  1. DefaultPawnClass = AWindGameCharacter::StaticClass();

At this point i just think this is a bug, I have been trying to get this fixed for a 3 days now, some one for the love of god give me a hand here.

Your path seems to be missing the name of the generated class at the end. It should be: TEXT("/Game/Blueprints/MainCharacter/Test.Test_C")

I have tried that, still the same.

That wont explain the same error when you just feed the variables to the game mode blueprint tho.

Bumping with hope!

Can you post screenshots of your WorldSettings and GameMode override. If you set up the main char correctly in GameMode then you don’t need to use ConstructorHelpers for your main character.

You can also just simply step through the ConstructorHelpers and watch it parse the file path to see where it’s going wrong.

I found out the solution after 3 days of working on this, it seems that newer versions of the engine have this variable on the defaultEditor.ini :

bDontLoadBlueprintOutsideEditor= false

Set it to false like so and it works again, hopefully people see this and dont have to go through the same trouble.