Skip to main content

Class NetworkSpawnManager

Class that handles object spawning

Inheritance

System.Object

NetworkSpawnManager

Inherited Members

System.Object.Equals(System.Object)

System.Object.Equals(System.Object, System.Object)

System.Object.GetHashCode()

System.Object.GetType()

System.Object.MemberwiseClone()

System.Object.ReferenceEquals(System.Object, System.Object)

System.Object.ToString()

Namespace: Unity.Netcode
Assembly: MLAPI.dll
Syntax
public class NetworkSpawnManager

Fields

OwnershipToObjectsTable

Use to get all NetworkObjects owned by a client Ownership to Objects Table Format: [ClientId][NetworkObjectId][NetworkObject] Server: Keeps track of all clients' ownership Client: Keeps track of only its ownership

Declaration
public readonly Dictionary<ulong, Dictionary<ulong, NetworkObject>> OwnershipToObjectsTable
Field Value
TypeDescription
System.Collections.Generic.Dictionary\<System.UInt64, System.Collections.Generic.Dictionary\<System.UInt64, NetworkObject>>

SpawnedObjects

The currently spawned objects

Declaration
public readonly Dictionary<ulong, NetworkObject> SpawnedObjects
Field Value
TypeDescription
System.Collections.Generic.Dictionary\<System.UInt64, NetworkObject>

SpawnedObjectsList

A list of the spawned objects

Declaration
public readonly HashSet<NetworkObject> SpawnedObjectsList
Field Value
TypeDescription
System.Collections.Generic.HashSet\<NetworkObject>

Properties

NetworkManager

Gets the NetworkManager associated with this SpawnManager.

Declaration
public NetworkManager NetworkManager { get; }
Property Value
TypeDescription
NetworkManager

Methods

GetClientOwnedObjects(UInt64)

Returns a list of all NetworkObjects that belong to a client.

Declaration
public List<NetworkObject> GetClientOwnedObjects(ulong clientId)
Parameters
TypeNameDescription
System.UInt64clientIdthe client's id LocalClientId
Returns
TypeDescription
System.Collections.Generic.List\<NetworkObject>returns the list of NetworkObjects owned by the client

GetLocalPlayerObject()

Returns the local player object or null if one does not exist

Declaration
public NetworkObject GetLocalPlayerObject()
Returns
TypeDescription
NetworkObjectThe local player object or null if one does not exist

GetPlayerNetworkObject(UInt64)

Returns the player object with a given clientId or null if one does not exist. This is only valid server side.

Declaration
public NetworkObject GetPlayerNetworkObject(ulong clientId)
Parameters
TypeNameDescription
System.UInt64clientIdthe client identifier of the player
Returns
TypeDescription
NetworkObjectThe player object with a given clientId or null if one does not exist