mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkServer.SpawnObject shows a warning when called with a server-only NetworkIdentity
This commit is contained in:
parent
f6dbf8c19e
commit
ede2c6c2c2
@ -73,7 +73,7 @@ public static class NetworkServer
|
|||||||
public static float disconnectInactiveTimeout = 60f;
|
public static float disconnectInactiveTimeout = 60f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// cache the Send(connectionIds) list to avoid allocating each time
|
/// cache the Send(connectionIds) list to avoid allocating each time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static readonly List<int> connectionIdsCache = new List<int>();
|
static readonly List<int> connectionIdsCache = new List<int>();
|
||||||
|
|
||||||
@ -217,7 +217,7 @@ public static bool RemoveConnection(int connectionId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// called by LocalClient to add itself. dont call directly.
|
/// called by LocalClient to add itself. dont call directly.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="conn"></param>
|
/// <param name="conn"></param>
|
||||||
internal static void SetLocalConnection(ULocalConnectionToClient conn)
|
internal static void SetLocalConnection(ULocalConnectionToClient conn)
|
||||||
@ -975,7 +975,7 @@ public static void SetClientNotReady(NetworkConnection conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// default ready handler.
|
/// default ready handler.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="conn"></param>
|
/// <param name="conn"></param>
|
||||||
/// <param name="msg"></param>
|
/// <param name="msg"></param>
|
||||||
@ -1060,6 +1060,14 @@ internal static void SpawnObject(GameObject obj, NetworkConnection ownerConnecti
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// spawning a server-only NetworkIdentity won't do anything, but
|
||||||
|
// might confuse someone. let's show a warning.
|
||||||
|
if (identity.serverOnly)
|
||||||
|
{
|
||||||
|
logger.LogWarning("SpawnObject for " + obj + " is server-only. Calling NetworkServer.Spawn wouldn't do anything.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (identity.SpawnedFromInstantiate)
|
if (identity.SpawnedFromInstantiate)
|
||||||
{
|
{
|
||||||
// Using Instantiate on SceneObject is not allowed, so stop spawning here
|
// Using Instantiate on SceneObject is not allowed, so stop spawning here
|
||||||
|
Loading…
Reference in New Issue
Block a user