Unreal Engine 5 · Blueprint → C++
Has Authority / Switch Has Authority in Unreal Engine 5 C++UE Docs
The Has Authority and Switch Has Authority Blueprint nodes are equivalent to calling HasAuthority() in C++, which returns true when the current machine is the server (or authority) for that Actor.
Blueprint node & C++ equivalent
if (HasAuthority())
{
// Server / authority branch
}What does the Has Authority node do?
Has Authority asks whether the local machine owns authority over an Actor, which in a standard listen or dedicated server setup means the server. Switch Has Authority is the execution-pin variant that splits the graph into an Authority branch and a Remote branch. Both exist so you only run server-critical logic, such as applying damage or spawning Actors, on the authoritative copy.
The C++ equivalent
In C++ you call HasAuthority(), a member function inherited from AActor, and branch with a normal if. The Authority branch of Switch Has Authority becomes the inside of if (HasAuthority()), and the Remote branch becomes the else.
Under the hood HasAuthority() checks the Actor's GetLocalRole() == ROLE_Authority, so it works for any replicated Actor without extra setup.
How to use it in C++
Wrap any logic that must only run on the server in the authority check, exactly as shown: if (HasAuthority()) { /* server / authority branch */ }. Common uses include validating input inside a Server RPC, mutating replicated variables, and calling SpawnActor. Code outside the check still runs everywhere, so keep purely cosmetic effects there.
Frequently asked questions
What is the C++ equivalent of the Has Authority node in UE5?+
It is the HasAuthority() function on AActor. Use if (HasAuthority()) to run code only on the server or authoritative machine.
Does HasAuthority() return true in single player?+
Yes. In standalone or single-player games the local machine is the authority, so HasAuthority() returns true and the authority branch runs.
What is the difference between Has Authority and Switch Has Authority?+
Both call the same HasAuthority() check. Switch Has Authority simply provides separate execution pins for the authority and remote branches, which in C++ is just an if/else.