Persistant PlayerControllers?

I have a local multiplayer game. When the main game level loads, I create 1 to 3 players using the CreatePlayer node in the GameMode Blueprint for the level. Everything works fine the first time the game level is loaded.

However, after completing a game, if I load my game’s main menu map, and then load the game level again with a different number of players, there are extra players still in the level.

For example, if I load a 3 player game first, then load the main menu, then load the game level with 2 players, the viewports are still setup for 3 players, and there is a third player just sitting in the level.

I believe that the created PlayerControllers from previous level loads are persisting between instances of loading the same level; Is there a way to not have this happen? I want the level to load exactly the same way it does the first time, every time.

Any help will be greatly appreciated. Thank you.

After some more searching, I happened across this post on the AnswerHub about how to remove a player in local multiplayer: [How do I remove a second splitscreen player? - Blueprint - Epic Developer Community Forums][1]

In Blueprint, there is a node called ExecuteConsoleCommand, and you can pass the Command “DebugRemovePlayer 1”, with 1 being the index number for the player you want to remove.

I was able to fix the issue with the persistant PlayerController by removing players at index 1, 2, and 3 in Event Begin Player, before creating any players.

This works, but I wonder if there is a better way to do this that doesn’t rely on debug console commands; which I don’t even know if they work in a shipping build…

I can confirm that this does not work in a Shipping Build of the game.

I really need to know how to remove players, or otherwise resolve this issue. Any help would be greatly appreciated.

I was able to find this AnswerHub question, whose answer contains a C++ method that removes all local splitscreen players from the game: How do I remove a split-screen player? - Multiplayer & Networking - Epic Developer Community Forums

I can confirm this works to resolve my issue; I simply call the function prior to creating any players, and I always get only the players I wanted to create and not any left over from a previous level.

There is now a Remove Player node in Blueprints, as well.