menu_bookDocumentation

Ownership - s&box Networking Documentation

calendar_today May 5, 2026 schedule ~1 min read person patrickjr verified 50

Ownership

Network ownership determines which client or the host has authority over a networked GameObject. The owner controls synced properties and can send RPCs.

Owner Transfer

By default, networked objects are owned by the host. You can transfer ownership to allow clients to control objects.

Getting the Owner

CSHARP
// Check who owns this object
Connection owner = GameObject.Network.Owner;

// Check if local client owns this
bool isOwner = GameObject.Network.IsOwner;

Taking Ownership

Clients can take ownership of objects:

CSHARP
// Try to take ownership
if ( GameObject.Network.TakeOwnership() )
{
    // Now we control this object
    // Can modify [Sync] properties
}

Dropping Ownership

Release ownership back to the host:

CSHARP
GameObject.Network.DropOwnership();

Default Owners

Objects spawned by a client are owned by that client by default. Objects spawned by the host are host-owned.

Disconnection

When an owner disconnects, you can control what happens:

CSHARP
// Set orphaned mode (only owner can do this)
GameObject.Network.SetOrphanedMode( NetworkOrphaned.Host );

Options:

ModeBehavior
DestroyObject destroyed when owner leaves (default)
HostHost takes ownership
RandomRandom client gets ownership
ClearOwnerNo owner, host simulates

Best Practices

  • Only modify [Sync] properties when you're the owner
  • Use Network.IsOwner checks before state changes
  • Transfer ownership for pickup/drop mechanics
  • Set orphaned modes for persistent objects
Was this helpful?