mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +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;
|
||||
|
||||
/// <summary>
|
||||
/// cache the Send(connectionIds) list to avoid allocating each time
|
||||
/// cache the Send(connectionIds) list to avoid allocating each time
|
||||
/// </summary>
|
||||
static readonly List<int> connectionIdsCache = new List<int>();
|
||||
|
||||
@ -217,7 +217,7 @@ public static bool RemoveConnection(int connectionId)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// called by LocalClient to add itself. dont call directly.
|
||||
/// called by LocalClient to add itself. dont call directly.
|
||||
/// </summary>
|
||||
/// <param name="conn"></param>
|
||||
internal static void SetLocalConnection(ULocalConnectionToClient conn)
|
||||
@ -975,7 +975,7 @@ public static void SetClientNotReady(NetworkConnection conn)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// default ready handler.
|
||||
/// default ready handler.
|
||||
/// </summary>
|
||||
/// <param name="conn"></param>
|
||||
/// <param name="msg"></param>
|
||||
@ -1060,6 +1060,14 @@ internal static void SpawnObject(GameObject obj, NetworkConnection ownerConnecti
|
||||
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)
|
||||
{
|
||||
// Using Instantiate on SceneObject is not allowed, so stop spawning here
|
||||
|
Loading…
Reference in New Issue
Block a user