AActor::HasLocalNetOwner
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtual
Description
Returns true if this actor's owner chain leads to a locally controlled player controller on the current machine. Use this to distinguish between actors owned by local vs remote players when running split-screen or listen-server scenarios.
Caveats & Gotchas
- • On a dedicated server, this always returns false because there are no locally controlled players — do not use it as a proxy for authority; use HasAuthority() instead.
- • In split-screen, multiple local player controllers can exist; an actor owned by Player 2 still returns true even if the querying code is running in Player 1's context — check the owning controller explicitly if you need per-player logic.
- • The function walks the full Owner chain and is not cached, so avoid calling it in tight per-frame loops.
Signature
ENGINE_API virtual bool HasLocalNetOwner() const; Return Type
bool Example
Show local player UI only for locally owned actors C++
void AMyPawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (HasLocalNetOwner())
{
// Only update HUD elements for the local player's pawn
UpdateHealthDisplay();
}
} See Also
Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?