Added null checks to NetworkedObject

This commit is contained in:
Albin Corén 2018-04-02 16:51:16 +02:00
parent 5beac0f00c
commit f258f0bb68

View File

@ -124,6 +124,7 @@ namespace MLAPI.MonoBehaviours.Core
private void OnDestroy()
{
if (NetworkingManager.singleton != null)
SpawnManager.OnDestroyObject(NetworkId, false);
}
@ -132,6 +133,7 @@ namespace MLAPI.MonoBehaviours.Core
/// </summary>
public void Spawn()
{
if (NetworkingManager.singleton != null)
SpawnManager.OnSpawnObject(this);
}
/// <summary>
@ -140,6 +142,7 @@ namespace MLAPI.MonoBehaviours.Core
/// <param name="clientId">The clientId to own the object</param>
public void SpawnWithOwnership(int clientId)
{
if (NetworkingManager.singleton != null)
SpawnManager.OnSpawnObject(this, clientId);
}
/// <summary>