PurrNet
  • 🐈Introduction
    • ‼️Unique to PurrNet
    • 💲Pricing
    • 💻Compatibility
    • 📚Addon library
    • 🗺️Roadmap
    • 🏎️Performance
      • RPC Benchmarks
      • Network Transform benchmarks
    • 🥰Support PurrNet
  • 📚Guides
    • Installation/Setup
    • Getting Started
    • Converting to PurrNet
      • Converting from Mirror
      • Converting from FishNet
    • Lobby System
    • Networking custom classes, structs & types
    • Chat system with broadcasts
    • Easy Multiplayer Physics (input Sync)
  • 🎮Full game guides
    • 🔫First Person Shooter
    • 🪓Survival Game
  • 🖥️Systems and modules
    • Network Manager
      • Network Rules
      • Network Prefabs
      • Network Visibility
        • Distance condition
      • Transports
        • Composite Transport
        • UDP Transport
        • Web Transport
        • Local Transport
        • Steam Transport
        • Purr Transport
      • Authentication
    • PlayerID (Client connection)
    • Network Identity
      • NetworkBehaviour
      • Ownership
      • Sync Types
        • SyncVar
        • SyncList
        • SyncArray
        • SyncQueue
        • SyncDictionary
        • SyncEvent
        • SyncHashset
        • SyncTimer
      • Don't destroy on load
    • Network Modules
    • Collider Rollback
    • Client Side Prediction
      • Overview
      • Predicted Identities
      • Predicted Hierarchy
      • Best Practices
      • Input Handling
      • State Handling
    • Plug n' play components
      • Network Transform
      • Network Animator
      • Network Reflection (Auto Sync)
      • State Machine (Auto Networked)
    • Spawning & Despawning
    • Remote Procedure Call (RPC)
      • Generic RPC
      • Static RPC
      • Awaitable RPC
      • Direct Local Execution of RPCs
    • Instance Handler
    • Scene Management
    • Broadcast
  • 🤓Terminology
    • Early Access
    • Channels
    • Client Auth/Everyone (Unsafe)
    • Host
    • Server Auth (Safe)
  • 💡Integrations
    • Dissonance
    • Cozy Weather
Powered by GitBook
On this page
  1. Systems and modules
  2. Network Identity

Ownership

PreviousNetworkBehaviourNextSync Types

Last updated 5 months ago

Ownership is relating to the relation between a and a . Upon spawning a new Network Identity, some level of ownership exists, whether that'd be no owner meaning the server has full control, or a can be the owner.

Being the owner of a , gives you different levels of authorization, depending on the of the . Keep in mind that being the owner of a network identity, doesn't mean you are directly the owner of every identity on the object. This is a setting that is specific per .

You can easily change ownership on your Network Identity by calling the GiveOwnership method, and feeding it the to be the new owner

networkIdentity.GiveOwnership(newOwnerPlayerId);

You can easily check for ownership by simply getting the owner. Be mindful that the owner and often other PlayerID references are nullable, meaning you should check whether they have a value or not.

if(owner.HasValue)
{
    //This object has an owner
    Debug.Log($"Owner of the object is: {owner.Value}");
}
else
{
    //This object has no owner
}

//You  can also easily check if you are the owner
if(isOwner) 
{
    //If we are here, we are the owner of the object
}

An easy way to check whether you have "control" of the object, meaning one of the two statements below is true: - There is an owner and I am the owner - There is no owner and I am the server Is to use the IsController bool.

if(IsController)
{
    //We are either the owner, or there is no owner and we're the server
    
}
else
{
    //We are not in control of this object
}
🖥️
player
Network Identity
player/client
Network Identity
Network Rules
network manager
network identity
PlayerID