Class NetworkIdentity
NetworkIdentity identifies objects across the network.
Inheritance
NetworkIdentity
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
|
Improve this Doc
View Source
sceneId
Unique identifier for NetworkIdentity objects within a scene, used for spawning scene objects.
Declaration
Field Value
|
Improve this Doc
View Source
serverOnly
Make this object only exist when the game is running as a server (or host).
Declaration
Field Value
|
Improve this Doc
View Source
visible
Declaration
public Visibility visible
Field Value
Properties
|
Improve this Doc
View Source
assetId
Prefab GUID used to spawn prefabs across the network.
Declaration
public Guid assetId { get; }
Property Value
|
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
|
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
|
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
|
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
|
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
|
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
|
Improve this Doc
View Source
isServer
Returns true if NetworkServer.active and server is not stopped.
Declaration
public bool isServer { get; }
Property Value
|
Improve this Doc
View Source
isServerOnly
True if this object only exists on the server
Declaration
public bool isServerOnly { get; }
Property Value
|
Improve this Doc
View Source
netId
The unique network Id of this object (unique at runtime).
Declaration
public uint netId { get; }
Property Value
|
Improve this Doc
View Source
NetworkBehaviours
Declaration
public NetworkBehaviour[] NetworkBehaviours { get; }
Property Value
|
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
|
Improve this Doc
View Source
SpawnedFromInstantiate
Declaration
public bool SpawnedFromInstantiate { get; }
Property Value
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
Returns
|
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
|
Improve this Doc
View Source
RemoveClientAuthority()
Removes ownership for an object.
Declaration
public void RemoveClientAuthority()
|
Improve this Doc
View Source
ResetNextNetworkId()
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