RealDocs

AActor::GetRemoteRole

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

Description

Returns the net role this actor has on the remote machine. On the server this reflects how clients regard the actor; on clients it is typically `ROLE_Authority`.

Caveats & Gotchas

  • On the server, `GetRemoteRole()` returns `ROLE_SimulatedProxy` for most replicated actors and `ROLE_AutonomousProxy` for player-controlled actors. Checking this helps distinguish server-to-client relationships.
  • On a client, `GetRemoteRole()` returns `ROLE_Authority` (the server's role). It is rarely useful to call this from client code; use `GetLocalRole()` or `HasAuthority()` instead.
  • Unlike `GetLocalRole()`, which reads a replicated property, `GetRemoteRole()` is not directly readable from blueprint in all contexts — use the BlueprintCallable accessor, not the raw `RemoteRole` property, for safe access.

Signature

UFUNCTION(BlueprintCallable, Category=Networking)
ENetRole GetRemoteRole() const;

Return Type

ENetRole

Example

Server checks whether a client is autonomous C++
void AMyGameMode::HandleActorReady(AActor* Actor)
{
	if (Actor->GetRemoteRole() == ROLE_AutonomousProxy)
	{
		// This actor is controlled by a connected player
		SetupPlayerSpecificLogic(Actor);
	}
}

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.