However, I have a multiplayer game with EOS and therefore don’t want to get the FirstPlayerController, but rather the PlayerController of the player currently executing this code. What do I need to change in the code? Thank you for any help
GetFirstPlayerController() returns the first Local player controller. And on the client you will never have more than one local PC, unless you doing split-screen game. So this function is completly fine to use.
Another case where you can have more than a single PC is a ListenServer: here you will have a client code running with all the players PCs present. But it’s still fine to use GetFirstPlayerController() in this case, since only host can have UI&local input that need to be handled here and host player is always a first player controller on server.
upd: i should stress that on listen server it’s fine to use firstPC in context of UI & Input handling. For most other gameplay problems you still have to find proper PC, but usually you have it from context of what are you doing.