Download

Change Character while playing

Hello there,
I would love to be able to change character anytime during the game but the other character must spawn from nowhere replacing the one i’m currently using, just like a virtual bench somewhere in the game.
Should I spawn and hide the substitute from the beginning or make it spawn when I need it?

There are multiple ways of implementing what you suggest.

The easiest might be: You can change the skeletal mesh that is driven by the mesh component of your character. This works as long as the meshes share a skeleton. The “cooking” step of building your game will build both character assets so they are both available.

Another option is to change the Pawn actor that your Player Controller is controlling. The “building” step will still build both the characters, but process of possessing the other character requires a little more work by the engine (but not very much more – it probably won’t matter.)

If you use the second option (change the Pawn) then I suggest using Destroy Actor on the original Pawn once you have Spawn Actor and Possessed the new Pawn. Unless you want the other character to somehow remain in the game (for AI control, or to have it keep sitting visible on a bench, or whatever.)

I actually have to keep the pawn in game because it should recover healt and mana while the other one is fighting, i’m not sure i can use the first option.
That’s excatly the logic answer I was looking for thank you :smiley: