Added null checks to NetworkedObject
This commit is contained in:
parent
5beac0f00c
commit
f258f0bb68
@ -124,7 +124,8 @@ namespace MLAPI.MonoBehaviours.Core
|
|||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
SpawnManager.OnDestroyObject(NetworkId, false);
|
if (NetworkingManager.singleton != null)
|
||||||
|
SpawnManager.OnDestroyObject(NetworkId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -132,7 +133,8 @@ namespace MLAPI.MonoBehaviours.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Spawn()
|
public void Spawn()
|
||||||
{
|
{
|
||||||
SpawnManager.OnSpawnObject(this);
|
if (NetworkingManager.singleton != null)
|
||||||
|
SpawnManager.OnSpawnObject(this);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Spawns an object across the network with a given owner. Can only be called from server
|
/// Spawns an object across the network with a given owner. Can only be called from server
|
||||||
@ -140,7 +142,8 @@ namespace MLAPI.MonoBehaviours.Core
|
|||||||
/// <param name="clientId">The clientId to own the object</param>
|
/// <param name="clientId">The clientId to own the object</param>
|
||||||
public void SpawnWithOwnership(int clientId)
|
public void SpawnWithOwnership(int clientId)
|
||||||
{
|
{
|
||||||
SpawnManager.OnSpawnObject(this, clientId);
|
if (NetworkingManager.singleton != null)
|
||||||
|
SpawnManager.OnSpawnObject(this, clientId);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes all ownership of an object from any client. Can only be called from server
|
/// Removes all ownership of an object from any client. Can only be called from server
|
||||||
|
Loading…
x
Reference in New Issue
Block a user