Character select / keep character blueprint through maps

Hello all,

I am having a bit of a problem.
I have been watching a lot of tutorials on how to make a character select screen and that is all working.
I start with a nice main menu (map0) and then it switches over to a character selection screen (still on map0)
I have a blueprint class for 1 character (a mage) and a blueprint class (a fighter)
It works if I stay on the same map, and I can play as either of the characters.

But if I then load the next map, i don’t stay on the same character. I just float under the map as if I am not possessing any actor.
My world settings are set to “default pawn class = none” because I can’t set it to a specific character, since it depends on what someone picked during character selection.

So how do I set it so that whatever someone picks at character selection, to become the default pawn class to load after that?

GameInstance is a good place to save you’re DefaultPawnClass because its data will remain after changing map.

For example:

  • Set PlayerClass variable in GameInstance when user choose a class in map0
  • In Level Blueprint of map1 EventBeginPlay>> take the PlayerClass variable from GameInstance and use it to set DefaultPawnClass in GameMode

Hello Silik1 !

Thank you for your help!

I could not get this to work just yet. It kept starting under the map, without a character still in Map1
But I read something earlier that the level blueprint works too slow? or doesnt initialize the default pawn class until after the level has already loaded and someone mentioned putting the script in the “construction scrip” part of the game mode since that part seems to load before a level loads.

After I put your “take the PlayerClass variable from GameInstance and use it to set DefaultPawnClass in GameMode” in the construction scrip tab of the game mode, then it started to work!
Thank you very much for the help! :slight_smile:

Glad I could help, thanks for coming back with this trick, I didn’t know we had access to the GameMode ConstructionScript :slight_smile:

Anytime :slight_smile:
Team effort right? :slight_smile:

could you recommand some tutos on how to create selection screen menu ???

OpenLevel function also have an Options string there for this kind of thing.