I’m trying to make a character changer and spawning an actor and possessing isn’t quite working with my setup but if I change the Default Pawn class on the editor, my setup works. So how can I change my Game Mode’s class in BP?
I’ve tried Set Default Pawn Class
I’ve tried making the Game Mode read the Default Pawn Class on a Game Instance variable
Changing game mode only to change your pawn class is overkill.
You can, for example, set the default pawn to none (meaning that no pawn/character will be automatically spawned) and then spawn and possess whatever pawn you want in the gamemode itself.
I’m not changing the Game Mode. I’m trying to change the Game Mode’s Default Pawn Class so game mode will read that default pawn class even if I quit the game
You need a Save Game. Store the Pawn Class you wish to be saved in a custom Game Instance. When you save the game have the save game object pull the variable from the Game Instance and store it. Then load the Pawn Class into the Game Instance on “New Game” or when you want to spawn the character. In the Gamemode, override the player spawn logic and write a custom spawn that spawns the class from the Game Instance, not the Gamemode.
Tried that approach but didn’t work. I made the Game Mode read a Set Default Pawn Class variable from a saved variable. I read somewhere that a function Spawn Default Pawn Class For can override it but don’t know how that works. I’ve searched about it online and can’t seem to find a tutorial on how to use it
If you want to override one the functions in the GM responsable for spawning the default pawn, so you can say which pawn class you want (in this case it’s stored in the gameinstance):