I’m making a multiplayer game using UE4.26. I have a GameMode class that extends GameModeBase, where on PostLogin, I assign team index to connected PlayerControllers. PostLogin works as expected.
When a player type “disconnect” into their console or alt+F4, I want to free the slot in my team array, but I cannot detect the disconnection event. Everyone says “use Logout function”, but when I extend it and put my code in, it’s never called. I put my log on every function of my GameMode class and it showed everywhere except Logout.
I test on both “Play As Client” in the editor, starting UE edtior with “-server” param, and building my own dedicated server using the special UE4 build from Github. AGameModeBase::Logout just never get called no matter how the client disconnect, reconnect, alt F4, unplug internet cable… nothing. Not called once.
Is this a bug only to UE4.26? Or did I miss something?
If this doesn’t work, Is there any other way I can detect player disconnection?