I’m trying to implement a multiplayer mode with splitscreen. The menu only contains 1 menu pawn. When the player presses the “Multiplayer” button, a new map is loaded and on begin play I call “Create Player” three times.
Everything works great, but when I return to the main menu by hitting escape and opening that map, the screen is still split with 4 player controllers active. I’ve tried destroying the extra controllers, un-possessing each of them, and trying to call “Quit Game” on each, none of these work and calling quit game crashes the editor.
Destroying the extra controllers?
Also in most cases returning to the main menu and then typing debugremoveplayer 3, then debugremoveplayer 2, then debugremoveplayer 1 in that order can fix the issue and restore it back to one player. When it comes down to “Quitting” depending on if that means quitting the session or the game itself, it shouldn’t be used on players 2 3 and 4.
If that suggestion doesn’t work, you may have to add a extra bit of code to your “multiplayer” code, such as telling the game to remove the three players upon the first player leaving that session.
I was wondering if since this point if you have found a way to do it within blueprint. If not then where would I put the code that you have posted above?
Actually, I have a stupid way to solve this problem: there’s a blueprint node for “Execute Console Command” so I used it to execute “DebugRemovePlayer 1”. This removes the player exactly how it should. Using string concatenation and a for loop I’d imagine anyone who needs to remove x many local players from their game will be able to do so, but I can’t imagine this is good practice.
Since people who work on the engine read these sometimes, why have a “Create Player” blueprint node if you’re not going to have a corresponding “Remove Player” one? It seems awfully inconvenient.
Hey!
There is a non-coding way to do that too. Go to Edit-> Project Settings-> Project section-> Maps&Modes-> uncheck the Enable split screen box.
Hope this helps (worked for me)
Cheers