Character Reference in player controller is null in Packaged game

Hello,

It seems I’ve encountered a problem when packaging my game. Some details before I get to the problem. My character class is a child class of BP_Character that is split into two genders BP_Male and BP_Female. In my character creator I set if the character is male or female and then spawn the child based off that decision. So now you have the background.

In the game world I spawn the character and load it’s variables from the character creator. I cast to the parent BP_Character in the Player Controller as seen here.

252909-cast-to-chararcter.jpg

The problem I’m having is that it works in Standalone mode but does not work in a packaged game. The Character reference is not valid even though it is in the editor.

Would someone know what my problem is?

Thanks

Well sometimes order of initialization is different in packaged game. Maybe this is the case. You can try to call Delay until GetControlledPawn returns a valid result. Also, try to package your game ‘By the book’.

Btw. do you test this in multiplayer?

Hello,

BP are not cooked by default, you have to use a bp class.

See here:

https://answers.unrealengine.com/questions/130256/whats-the-correct-way-to-load-blueprints-for-packa.html

Cedric

This seemed to work for me. I added a function to the event tick of my player controller that checks if it’s valid, if it’s not it keeps looping until it is valid. Now I need to rework my save and load feature to be in line with this.

And no, no multiplayer yet.