And what’s the difference between a player ID and a player Index, for that matter?
GetPlayerController returns the controller of the pawn that you called it on. GetPlayerControllerFromID is used if you have a player ID that you want to get the controller for, and is not called on a specific pawn.
I’ve not heard of a PlayerIndex. Might be the same. unsure.
I’m calling GetPlayerController from a UI Widget. I don’t want to get the player controller of the widget’s owner, but rather another player.
This is because the widget’s purpose is to detect which player pressed the fire button and assign that next widget to that player so they can configure options for their character in a 4-player local splitscreen game. However, this menu is not splitscreen, it has a widget for each player to use to set up their character though. Then when the gameplay begins, it will be splitscreen.
I’m routing function calls to different players than those who give the inputs, so that you can for example, have player 0 on a gamepad, player 1 on WASD keys (keyboard input is always p0), player 2 on arrow keys (again always p0), and player 4 on another gamepad (1st gamepad is also p0). I’m doing this by mapping a control method enumerator to player indexes and then having the event dispatchers for handling the inputs after routing be bound to the UI widgets and pawns.
But I wonder if there’s a better way because this is tedious and tricky.
ah, i know exactly zero about what’s inside the widget library for blueprints, have not done more than a cursory bug fix inside a menu in UE5.
Might have to look in the docs, or in the code, to see what those functions do.