SpawnManager class
Namespace: MLAPI.Spawning
Assembly: MLAPI.dll
Class that handles object spawning
Public Fields
public Dictionary<ulong,NetworkedObject>
SpawnedObjects;
The currently spawned objects
public List<NetworkedObject>
SpawnedObjectsList;
A list of the spawned objects
Public Static Methods
public static void
RegisterSpawnHandler(ulong
prefabHash, SpawnHandlerDelegate
handler);
Registers a delegate for spawning networked prefabs, useful for object pooling
Parameters
ulong
prefabHash
The prefab hash to spawn
SpawnHandlerDelegate
handler
The delegate handler
public static void
RegisterCustomDestroyHandler(ulong
prefabHash, DestroyHandlerDelegate
handler);
Registers a delegate for destroying networked objects, useful for object pooling
Parameters
ulong
prefabHash
The prefab hash to destroy
DestroyHandlerDelegate
handler
The delegate handler
public static void
RemoveCustomSpawnHandler(ulong
prefabHash);
Removes the custom spawn handler for a specific prefab hash
Parameters
ulong
prefabHash
The prefab hash of the prefab spawn handler that is to be removed
public static void
RemoveCustomDestroyHandler(ulong
prefabHash);
Removes the custom destroy handler for a specific prefab hash
Parameters
ulong
prefabHash
The prefab hash of the prefab destroy handler that is to be removed
public static int
GetNetworkedPrefabIndexOfHash(ulong
hash);
Gets the prefab index of a given prefab hash
Parameters
ulong
hash
The hash of the prefab
Returns int
The index of the prefab
public static ulong
GetPrefabHashFromIndex(int
index);
Returns the prefab hash for the networked prefab with a given index
Parameters
int
index
The networked prefab index
Returns ulong
The prefab hash for the given prefab index
public static ulong
GetPrefabHashFromGenerator(string
generator);
Returns the prefab hash for a given prefab hash generator
Parameters
string
generator
The prefab hash generator
Returns ulong
The hash for the given generator
public static NetworkedObject
GetLocalPlayerObject();
Returns the local player object or null if one does not exist
Returns NetworkedObject
The local player object or null if one does not exist
public static NetworkedObject
GetPlayerObject(ulong
clientId);
Returns the player object with a given clientId or null if one does not exist
Parameters
ulong
clientId
Returns NetworkedObject
The player object with a given clientId or null if one does not exist
Inherited Methods
public bool
Equals(object
obj);
Inherited from: object
Parameters
object
obj