How Can i select default Pawn class from button?


is there any way to change gamemodes default pawn class with a button? please help

Technically, you can change it like this

But I have no idea what that means. Because if you’re already running a level, it’s too late, and you can save it ready for another level.

You can choose what class of pawn to spawn, instead of using the game mode, though…

1 Like

Yeah, i would agree with @ClockworkOcean here. Its already too late if you change it dynamically. If you want to have multiple pawns within one game cycle, just use method SpawnActorFromClass, and then select your new Pawn, and just possess it. Here is an example doing it from PlayerController. If you do it outside of PlayerController, you will need PlayerController's reference for Target node.

1 Like

Interestingly enough, it is and isn’t at the same time:

The red bit is not so clear.

  • if the player instance exists, it will change the class but it does not destroy the existing Pawn and simply places them at Player Start
  • if there’s no player spawned, the Game Mode will spawn a new default pawn and possess it

@acegxd Try:

3 Likes

Nice to know, thanks!

Is this the game mode blueprint? or the level blueprint

It does not matter. You might as well put it in a widget.

It worked fine!
I added a Teleport so the Pawn will spawn in the same location, not at the Player Start.

where do I put this?

Pretty much up to you. You can access the framework from wherever.

So this is the blueprint in my pick character widget, do I add that whole bracket on each of these buttons with the desired pawn?

am i using this screenshot sorry