How to change pawn from a menu

Hi in my game your default pawn is a rocket, you unlock other rockets throughout the game which you can switch to from the menu.

What I can’t seem to figure out is how to actually change my pawn/posses a different pawn before the level starts.

All the tutorials or information I’ve read upon this uses casting to the desired pawn/character using a reference within the level. From my main menu level there is no selectable pawns within it, therefor I’m stuck.

I was thinking maybe when you select your rocket/pawn it stores a string/int variable somewhere which correlates with which rocket you spawn with on level start, but I’m still stuck on how to implement this.

My rocket pawns are all children pawns of a pawn class with different parameters for slightly different controls.

Please can someone help me out on this as it’s driving me insane


Basically, the widget will set a variable which is a blueprint class. The class of you pawn.

Typically, it would be useful to have that variable somewhere more accessible, like in the game instance. So, you can keep it there.

Somehow then, there are many ways, you need to start your levels ‘pawnless’, take a look in the game instance, spawn and posses the right kind of pawn.

Assuming you’re using OpenLevel, a logical place to do this would be the level blueprint. On begin play, the level BP opens the game instance, grabs the pawn type, spawns it, and makes sure you posses it.

Thank you, this makes sense and is explained very well! I will try it when I get back home

1 Like

Yes, like @ClockworkOcean said, set class through widget to store it in your gameinstance, but from there what i did, I casted my gameinstance from the gamemode and then grabbed the pawn class from there to posses, you can do both ways

Thank you all this sorted my problem! For now I’m just spawning the pawn from level begin play. Its so simple now I’ve done it, annoying how long it’s took to get it working lol

1 Like