RealDocs

APawn::GetPlatformUserId

function Engine Blueprint Since 5.1
#include "GameFramework/Pawn.h"
Access: public Specifiers: UFUNCTIONBlueprintCallableBlueprintPure

Description

Returns the platform user ID of the local PlayerController controlling this pawn. Returns an invalid ID if not controlled by a local player.

Caveats & Gotchas

  • Returns an invalid `FPlatformUserId` for AI-controlled pawns and for remote player pawns on a server — always call `IsValid()` on the result before using it.
  • This is a thin wrapper over the controlling PlayerController's platform user; it does not cache the value, so the cost is a controller pointer dereference on every call.

Signature

FPlatformUserId GetPlatformUserId() const

Return Type

FPlatformUserId

Example

Look up platform achievements for this player C++
FPlatformUserId UserId = GetPlatformUserId();
if (UserId.IsValid())
{
	IOnlineSubsystem::Get()->GetAchievementsInterface()->QueryAchievements(UserId.GetUniqueNetId(), ...);
}

Version History

Introduced in: 5.1

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.