Search Results for

    Show / Hide Table of Contents

    Class NetworkIdentity

    NetworkIdentity identifies objects across the network.

    Inheritance
    Object
    NetworkIdentity
    Namespace: Mirror
    Assembly: doc.dll
    Syntax
    public sealed class NetworkIdentity : MonoBehaviour

    Fields

    | Improve this Doc View Source

    observers

    The set of network connections (players) that can see this object.

    Declaration
    public Dictionary<int, NetworkConnectionToClient> observers
    Field Value
    Type Description
    Dictionary<Int32, NetworkConnectionToClient>
    | Improve this Doc View Source

    sceneId

    Unique identifier for NetworkIdentity objects within a scene, used for spawning scene objects.

    Declaration
    public ulong sceneId
    Field Value
    Type Description
    UInt64
    | Improve this Doc View Source

    serverOnly

    Make this object only exist when the game is running as a server (or host).

    Declaration
    public bool serverOnly
    Field Value
    Type Description
    Boolean
    | Improve this Doc View Source

    visible

    Declaration
    public Visibility visible
    Field Value
    Type Description
    Visibility

    Properties

    | Improve this Doc View Source

    assetId

    Prefab GUID used to spawn prefabs across the network.

    Declaration
    public Guid assetId { get; }
    Property Value
    Type Description
    Guid
    | Improve this Doc View Source

    connectionToClient

    Server's network connection to the client. This is only valid for client-owned objects (including the Player object) on the server.

    Declaration
    public NetworkConnectionToClient connectionToClient { get; }
    Property Value
    Type Description
    NetworkConnectionToClient
    | Improve this Doc View Source

    connectionToServer

    Client's network connection to the server. This is only valid for player objects on the client.

    Declaration
    public NetworkConnection connectionToServer { get; }
    Property Value
    Type Description
    NetworkConnection
    | Improve this Doc View Source

    hasAuthority

    True on client if that component has been assigned to the client. E.g. player, pets, henchmen.

    Declaration
    public bool hasAuthority { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    isClient

    Returns true if running as a client and this object was spawned by a server.

    Declaration
    public bool isClient { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    isClientOnly

    True if this object exists on a client that is not also acting as a server.

    Declaration
    public bool isClientOnly { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    isLocalPlayer

    Return true if this object represents the player on the local machine.

    Declaration
    public bool isLocalPlayer { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    isServer

    Returns true if NetworkServer.active and server is not stopped.

    Declaration
    public bool isServer { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    isServerOnly

    True if this object only exists on the server

    Declaration
    public bool isServerOnly { get; }
    Property Value
    Type Description
    Boolean
    | Improve this Doc View Source

    netId

    The unique network Id of this object (unique at runtime).

    Declaration
    public uint netId { get; }
    Property Value
    Type Description
    UInt32
    | Improve this Doc View Source

    NetworkBehaviours

    Declaration
    public NetworkBehaviour[] NetworkBehaviours { get; }
    Property Value
    Type Description
    NetworkBehaviour[]
    | Improve this Doc View Source

    spawned

    All spawned NetworkIdentities by netId. Available on server and client.

    Declaration
    public static Dictionary<uint, NetworkIdentity> spawned { get; }
    Property Value
    Type Description
    Dictionary<UInt32, NetworkIdentity>
    | Improve this Doc View Source

    SpawnedFromInstantiate

    Declaration
    public bool SpawnedFromInstantiate { get; }
    Property Value
    Type Description
    Boolean

    Methods

    | Improve this Doc View Source

    AssignClientAuthority(NetworkConnectionToClient)

    Assign control of an object to a client via the client's NetworkConnection.

    Declaration
    public bool AssignClientAuthority(NetworkConnectionToClient conn)
    Parameters
    Type Name Description
    NetworkConnectionToClient conn
    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    GetSceneIdentity(UInt64)

    Gets the NetworkIdentity from the sceneIds dictionary with the corresponding id

    Declaration
    public static NetworkIdentity GetSceneIdentity(ulong id)
    Parameters
    Type Name Description
    UInt64 id
    Returns
    Type Description
    NetworkIdentity
    | Improve this Doc View Source

    RemoveClientAuthority()

    Removes ownership for an object.

    Declaration
    public void RemoveClientAuthority()
    | Improve this Doc View Source

    ResetNextNetworkId()

    Resets nextNetworkId = 1

    Declaration
    public static void ResetNextNetworkId()

    Events

    | Improve this Doc View Source

    clientAuthorityCallback

    A callback that can be populated to be notified when the client-authority state of objects changes.

    Declaration
    public static event NetworkIdentity.ClientAuthorityCallback clientAuthorityCallback
    Event Type
    Type Description
    NetworkIdentity.ClientAuthorityCallback
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX