Skip to main content

MLAPI.Spawning.NetworkSpawnManager

Class that handles object spawning

Inheritance#

System.Dynamic.ExpandoObject

System.Dynamic.ExpandoObject

Inherited Members#

Object.Equals(Object)

Object.Equals(Object, Object)

Object.GetHashCode()

Object.GetType()

Object.MemberwiseClone()

Object.ReferenceEquals(Object, Object)

Object.ToString()

Namespace: System.Dynamic.ExpandoObject#
Assembly: MLAPI.dll#
Syntax#
public static class NetworkSpawnManager

Fields#

SpawnedObjects#

The currently spawned objects

Declaration#

public static readonly Dictionary<ulong, NetworkObject> SpawnedObjects

Field Value#

TypeDescription
System.Collections.Generic.Dictionary<System.UInt64, NetworkObject>

SpawnedObjectsList#

A list of the spawned objects

Declaration#

public static readonly HashSet<NetworkObject> SpawnedObjectsList

Field Value#

TypeDescription
System.Collections.Generic.HashSet<NetworkObject>

Methods#

GetLocalPlayerObject()#

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

Declaration#

public static NetworkObject GetLocalPlayerObject()

Returns#

TypeDescription
NetworkObjectThe local player object or null if one does not exist

GetNetworkPrefabIndexOfHash(UInt64)#

Gets the prefab index of a given prefab hash

Declaration#

public static int GetNetworkPrefabIndexOfHash(ulong hash)

Parameters#

TypeNameDescription
System.UInt64hashThe hash of the prefab

Returns#

TypeDescription
System.Int32The index of the prefab

GetPlayerNetworkObject(UInt64)#

Returns the player object with a given clientId or null if one does not exist

Declaration#

public static NetworkObject GetPlayerNetworkObject(ulong clientId)

Parameters#

TypeNameDescription
System.UInt64clientId

Returns#

TypeDescription
NetworkObjectThe player object with a given clientId or null if one does not exist

GetPrefabHashFromGenerator(String)#

Returns the prefab hash for a given prefab hash generator

Declaration#

public static ulong GetPrefabHashFromGenerator(string generator)

Parameters#

TypeNameDescription
System.StringgeneratorThe prefab hash generator

Returns#

TypeDescription
System.UInt64The hash for the given generator

GetPrefabHashFromIndex(Int32)#

Returns the prefab hash for the NetworkPrefab with a given index

Declaration#

public static ulong GetPrefabHashFromIndex(int index)

Parameters#

TypeNameDescription
System.Int32indexThe NetworkPrefab index

Returns#

TypeDescription
System.UInt64The prefab hash for the given prefab index

RegisterDestroyHandler(UInt64, NetworkSpawnManager.DestroyHandlerDelegate)#

Registers a delegate for destroying NetworkObjects, useful for object pooling

Declaration#

public static void RegisterDestroyHandler(ulong prefabHash, NetworkSpawnManager.DestroyHandlerDelegate handler)

Parameters#

TypeNameDescription
System.UInt64prefabHashThe prefab hash to destroy
NetworkSpawnManager.DestroyHandlerDelegatehandlerThe delegate handler

RegisterSpawnHandler(UInt64, NetworkSpawnManager.SpawnHandlerDelegate)#

Registers a delegate for spawning NetworkPrefabs, useful for object pooling

Declaration#

public static void RegisterSpawnHandler(ulong prefabHash, NetworkSpawnManager.SpawnHandlerDelegate handler)

Parameters#

TypeNameDescription
System.UInt64prefabHashThe prefab hash to spawn
NetworkSpawnManager.SpawnHandlerDelegatehandlerThe delegate handler

UnregisterDestroyHandler(UInt64)#

Unregisters the custom destroy handler for a specific prefab hash

Declaration#

public static void UnregisterDestroyHandler(ulong prefabHash)

Parameters#

TypeNameDescription
System.UInt64prefabHashThe prefab hash of the prefab destroy handler that is to be removed

UnregisterSpawnHandler(UInt64)#

Unregisters the custom spawn handler for a specific prefab hash

Declaration#

public static void UnregisterSpawnHandler(ulong prefabHash)

Parameters#

TypeNameDescription
System.UInt64prefabHashThe prefab hash of the prefab spawn handler that is to be removed