UKismetInputLibrary::GetUserIndex
#include "Kismet/KismetInputLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns the index of the local user (controller/player) that generated this key event, for local multiplayer or split-screen input routing.
Caveats & Gotchas
- • Always 0 in single-player or when input isn't associated with a specific platform user, so don't rely on it to detect multi-user setups.
- • This is the platform user index, not the PlayerController's PlayerId — map it through the appropriate local player subsystem if you need the owning PlayerController.
Signature
static int32 GetUserIndex(const FKeyEvent& Input); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Input | const FKeyEvent& | The key event to read the originating user index from. | — |
Return Type
int32 Example
Route a key event to the correct local player C++
FReply UMyWidget::NativeOnKeyDown(const FGeometry& InGeometry, const FKeyEvent& InKeyEvent)
{
const int32 UserIndex = UKismetInputLibrary::GetUserIndex(InKeyEvent);
RouteInputToLocalPlayer(UserIndex, InKeyEvent);
return FReply::Handled();
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?