How to change default pawn?

sorry for my bad English.
is it possible to change default pawn when pressing a keyboard button?

Yes, from the controller, unposses the current pawn, and then spawn if needed a new pawn and posses it.

I think you just can assign DefaultPawnClass in AGameMode something different to change the default pawn. Notice that only new pawns will be of this type though.

How to change it at run time?
for example, when player pressed F button change DefaultPawnClass

I believe you want something like the possess function which allows your controller class to control a different pawn/character.

What you could do is overload the GetDefaultPawnClassForController_Implementation function in your GameMode class, and let it check for some property of the Player Controller that indicates which pawn class is needed.

Hi abrar.b

I believe Dune is correct in this case. Changing the default pawn class at runtime will not make any changes to anything else at runtime, as this variable only determines what the initial pawn to be possessed will be. You would need to possess something else if you wish to change what your player is controlling if you wish to do this at runtime.