Course contentsShow
← Unreal Engine Game Development
Lesson 739 of 88010. Networking and ReplicationFree lesson

Defining Actor Ownership and Connection Hierarchies

Master the concept of actor ownership to correctly assign control and authority over players, controllers, and their associated sub-objects.

In this lesson, you will learn how the relationship between Actors and their Owner dictates network authority and determines which client receives specific RPCs.

The Concept of Ownership

In Unreal Engine, ownership is a hierarchical relationship that defines the "chain of command" for network packets. Every Actor has an Owner property. When a server sends an RPC designated for a specific client (a Client RPC), the engine looks at the target Actor’s ownership chain. It traverses up from the Actor to its owner, then to the owner's owner, until it identifies a PlayerController.

The PlayerController acts as the definitive bridge to a network connection. If the chain leads to a connection belonging to Client A, that client is considered the "owner" of the object, and only that client can receive Client RPCs executed on that object.

Defining the Hierarchy

The hierarchy usually flows like this: Connection -> PlayerController -> Pawn -> InventoryItems/Abilities

When you spawn an item—like a weapon—that belongs to a player, you must call SetOwner() to link that weapon to the Pawn or Controller. Without this link, the server doesn't know which connection is associated with the weapon, and RPCs intended for that weapon will fail or be dropped because the engine cannot resolve the "owning" connection.

// Example: Spawning a weapon and assigning ownership
AActor* NewWeapon = GetWorld()->SpawnActor<AWeapon>(WeaponClass);
if (NewWeapon)
{
    // Setting the owner ensures RPCs (like FireWeapon) reach the correct client
    NewWeapon->SetOwner(this); 
}

Why Hierarchy Matters

If you have an object that isn't owned by a PlayerController (or its child), the system treats it as "server-owned" or "unowned." In this state, Client RPCs cannot be reliably routed because there is no single connection target. By maintaining a clean ownership hierarchy, you ensure that network traffic is localized to the relevant players, reducing unnecessary overhead and preventing security leaks where one client might receive updates meant for another.

Key Takeaway: Ownership is the hierarchical pointer system that maps Actors to specific network connections; without explicitly setting an Owner, the server cannot route RPCs to the correct client.