RealDocs

APawn::IsLocallyControlled

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

Description

Returns `true` if this pawn is controlled by a local (non-network) controller — i.e., the controller exists on the same machine executing this code.

Caveats & Gotchas

  • On a dedicated server this returns `false` for all player pawns because the PlayerController is on the client. Use `HasAuthority()` if you need a server-only check, or `IsPlayerControlled()` to detect human control regardless of locality.
  • For AI-controlled pawns on a server, this returns `true` because the AIController is local to the server — which is often unexpected when using this as a 'player input' guard.

Signature

virtual bool IsLocallyControlled() const

Return Type

bool

Examples

Skip first-person cosmetics on Tick for non-locally-controlled pawns Blueprint
Event Tick Delta Seconds Delta Seconds Branch Condition Condition True False Print String In String Updating local cosmetics Updating local cosmetics Is Locally Controlled Target is Pawn Return Value
Edit Blueprint graph Skip first-person cosmetics on Tick for non-locally-controlled pawns
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
Skip cosmetic effects for non-local pawns C++
void AMyPawn::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	if (IsLocallyControlled())
	{
		UpdateFirstPersonEffects(DeltaTime);
	}
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.