Hi, can I set different player controller classes for different players at runtime, or alternatively can I have one player controller class for the listen-server owner and a different player controller class for all other players logging into the listen server?
Interesting question… I’ll offer a disclaimer upfront that I don’t know the answer here, but I can offer some suggestions… First, in general, I think most devs would just opt to Spawn a variant of the Pawn and then override the Camera - Inputs - UI from the Pawn instead… If that didn’t work, then they’d use flow control functions like IsServer / HasAuthority from within the PC, to branch to different dependant code on the ListenServer etc, for example, to customize things or change individual PC behaviour etc… But overall, and I could be wrong, I don’t remember seeing anything in BP to do what you’re asking, not reliably at least… Switching pawns is one thing but PC’s??? I’m doubtful that BP will let you do that on the Listen Server anyway… So I’m assuming you can’t for now…
That said, here’s a recent thread where the dev couldn’t get ‘Create Player’ working, and so instead opted to Spawn Controllers manually, and then override PlayerController ID’s afterwards. Note, its not working for them currently, but maybe there’s a way to make this work, I don’t know… For example if you could spawn a Controller called Server-Controller and then set the Player-Controller-ID to 0 using Gamemode on the ListenServer, maybe you could switch out the original Player-Controller for the ListenServer player that way. I’d be very curious if you get this working… If so, please share… Also I bet some of the C++ guys would know instantly whether this would even work or not, so it might be worth posting there too. Good luck and let us know either way!
I have thought about having different code in the PC and switching, but I think it will get very complex. I thought also of having the listen to server use the default player controller and then after the listen server has started change the level’s default player controllers so all other players get the new PC
Just wanted to chime in and say I’m frustrated there isn’t an option for this already. I entered a feature request for this but who knows how long it’ll be. Incorporating different input states for a single controller is a mess. It’s looking like I’ll need separate executables or something for VR/non-VR versions of my game