Download

Add a "Swap Controller" Blueprint node

I’d like to first provide a brief example of why I need this:

I have a simple main menu widget with 3 buttons: third person view mode, first person view mode, and VR mode. When either of these buttons are clicked, a Name variable in my custom game instance object is set (TPS, FPS, VR).

I then load my ShootingRange map which uses my Deatmatch game mode, and in the Starting New Player event in the game mode, I am determining which pawn to spawn for the player to possess, according to the TPS/FPS/VR mode that was chosen.

I am trying to also set which controller the player uses for those pawns. I have 3 separate controllers for the 3 pawns. This would be a mess to incorporate all my controls into the pawns, because then I can’t just have 1 general “VR Controller” for other pawns I want to add and posses in the future, like vehicles. Not to mention, before the pawn is spawned, the player is using a Spectator controller with totally different behavior than what the TPS/FPS/VR controllers have.

I believe that through C++, there’s a simple method that allows you to switch a player’s controller (SwapController) which triggers the OnSwapPlayerControllers event. I find it surprising there isn’t a blueprint node to do the same.

Actually, no, C++ doesn’t have this feature built-in either. This my PR which tries to introduce the first step needed for such functionality: https://github.com/EpicGames/UnrealEngine/pull/6708