mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkServer - added gameobject param to debug logs
This commit is contained in:
parent
6c101c5c85
commit
4434ab1be3
@ -1140,20 +1140,20 @@ static void SpawnObject(GameObject obj, NetworkConnection ownerConnection)
|
|||||||
// verify if we can spawn this
|
// verify if we can spawn this
|
||||||
if (Utils.IsPrefab(obj))
|
if (Utils.IsPrefab(obj))
|
||||||
{
|
{
|
||||||
Debug.LogError($"GameObject {obj.name} is a prefab, it can't be spawned. Instantiate it first.");
|
Debug.LogError($"GameObject {obj.name} is a prefab, it can't be spawned. Instantiate it first.", obj);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!active)
|
if (!active)
|
||||||
{
|
{
|
||||||
Debug.LogError($"SpawnObject for {obj}, NetworkServer is not active. Cannot spawn objects without an active server.");
|
Debug.LogError($"SpawnObject for {obj}, NetworkServer is not active. Cannot spawn objects without an active server.", obj);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkIdentity identity = obj.GetComponent<NetworkIdentity>();
|
NetworkIdentity identity = obj.GetComponent<NetworkIdentity>();
|
||||||
if (identity == null)
|
if (identity == null)
|
||||||
{
|
{
|
||||||
Debug.LogError($"SpawnObject {obj} has no NetworkIdentity. Please add a NetworkIdentity to {obj}");
|
Debug.LogError($"SpawnObject {obj} has no NetworkIdentity. Please add a NetworkIdentity to {obj}", obj);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1167,7 +1167,7 @@ static void SpawnObject(GameObject obj, NetworkConnection ownerConnection)
|
|||||||
// Spawn should only be called once per netId
|
// Spawn should only be called once per netId
|
||||||
if (spawned.ContainsKey(identity.netId))
|
if (spawned.ContainsKey(identity.netId))
|
||||||
{
|
{
|
||||||
Debug.LogWarning($"{identity} with netId={identity.netId} was already spawned.");
|
Debug.LogWarning($"{identity} with netId={identity.netId} was already spawned.", identity.gameObject);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user