Skip to content

Commit 1e64764

Browse files
committed
Fix log level + revert internal log and EnableDistributeLogging
1 parent d4bef43 commit 1e64764

File tree

1 file changed

+10
-31
lines changed

1 file changed

+10
-31
lines changed

com.unity.netcode.gameobjects/Runtime/Spawning/NetworkSpawnManager.cs

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ internal bool RemoveObjectFromShowingTo(NetworkObject networkObject, ulong clien
211211
// probably overkill, but deals with multiple entries
212212
while (ObjectsToShowToClient[clientId].Contains(networkObject))
213213
{
214-
if (NetworkManager.LogLevel <= LogLevel.Developer)
214+
if (NetworkManager.LogLevel > LogLevel.Normal)
215215
{
216216
NetworkLog.LogWarning($"Object was shown and hidden from the same client in the same Network frame. As a result, the client will _not_ receive a NetworkSpawn");
217217
}
@@ -777,7 +777,7 @@ public NetworkObject InstantiateAndSpawn(NetworkObject networkPrefab, ulong owne
777777

778778
if (NetworkManager.ShutdownInProgress)
779779
{
780-
if (NetworkManager.LogLevel <= LogLevel.Developer)
780+
if (NetworkManager.LogLevel <= LogLevel.Normal)
781781
{
782782
NetworkLog.LogWarning(InstantiateAndSpawnErrors[InstantiateAndSpawnErrorTypes.InvokedWhenShuttingDown]);
783783
}
@@ -2089,10 +2089,7 @@ internal void DistributeNetworkObjects(ulong clientId)
20892089
var offsetCount = Mathf.Max((int)Math.Round((float)(ownerList.Value.Count / objPerClient)), 1);
20902090
if (EnableDistributeLogging)
20912091
{
2092-
if (NetworkManager.LogLevel <= LogLevel.Developer)
2093-
{
2094-
NetworkLog.LogInfo($"[{objPerClient} of {totalObjectsToDistribute}][Client-{ownerList.Key}] Count: {ownerList.Value.Count} | ObjPerClient: {objPerClient} | maxD: {maxDistributeCount} | Offset: {offsetCount}");
2095-
}
2092+
Debug.Log($"[{objPerClient} of {totalObjectsToDistribute}][Client-{ownerList.Key}] Count: {ownerList.Value.Count} | ObjPerClient: {objPerClient} | maxD: {maxDistributeCount} | Offset: {offsetCount}");
20962093
}
20972094

20982095
for (int i = 0; i < ownerList.Value.Count; i++)
@@ -2112,7 +2109,7 @@ internal void DistributeNetworkObjects(ulong clientId)
21122109
}
21132110
if (!child.IsOwnershipDistributable || !child.IsOwnershipTransferable)
21142111
{
2115-
if (NetworkManager.LogLevel <= LogLevel.Developer)
2112+
if (NetworkManager.LogLevel <= LogLevel.Normal)
21162113
{
21172114
NetworkLog.LogWarning($"Sibling {child.name} of root parent {ownerList.Value[i].name} is neither transferable or distributable! Object distribution skipped and could lead to a potentially un-owned or owner-mismatched {nameof(NetworkObject)}!");
21182115
}
@@ -2126,10 +2123,7 @@ internal void DistributeNetworkObjects(ulong clientId)
21262123
ChangeOwnership(ownerList.Value[i], clientId, true);
21272124
if (EnableDistributeLogging)
21282125
{
2129-
if (NetworkManager.LogLevel <= LogLevel.Developer)
2130-
{
2131-
NetworkLog.LogInfo($"[Client-{ownerList.Key}][NetworkObjectId-{ownerList.Value[i].NetworkObjectId} Distributed to Client-{clientId}");
2132-
}
2126+
Debug.Log($"[Client-{ownerList.Key}][NetworkObjectId-{ownerList.Value[i].NetworkObjectId} Distributed to Client-{clientId}");
21332127
}
21342128
distributed++;
21352129
}
@@ -2160,10 +2154,7 @@ internal void DistributeNetworkObjects(ulong clientId)
21602154
builder.AppendLine($"[Client-{ownerList.Key}] Count: {ownerList.Value.Count}");
21612155
}
21622156
}
2163-
if (NetworkManager.LogLevel <= LogLevel.Developer)
2164-
{
2165-
NetworkLog.LogInfo(builder.ToString());
2166-
}
2157+
Debug.Log(builder.ToString());
21672158
}
21682159
}
21692160

@@ -2287,19 +2278,13 @@ internal void ShowHiddenObjectsToNewlyJoinedClient(ulong newClientId)
22872278
{
22882279
if (!NetworkManager.DistributedAuthorityMode)
22892280
{
2290-
if (NetworkManager.LogLevel <= LogLevel.Error)
2291-
{
2292-
NetworkLog.LogError($"[Internal Error] {nameof(ShowHiddenObjectsToNewlyJoinedClient)} should only be invoked when using a distributed authority network topology!");
2293-
}
2281+
Debug.LogError($"[Internal Error] {nameof(ShowHiddenObjectsToNewlyJoinedClient)} should only be invoked when using a distributed authority network topology!");
22942282
return;
22952283
}
22962284

22972285
if (NetworkManager.LocalClient.IsSessionOwner)
22982286
{
2299-
if (NetworkManager.LogLevel <= LogLevel.Error)
2300-
{
2301-
NetworkLog.LogError($"[Internal Error] {nameof(ShowHiddenObjectsToNewlyJoinedClient)} should only be invoked on a non-session owner client!");
2302-
}
2287+
Debug.LogError($"[Internal Error] {nameof(ShowHiddenObjectsToNewlyJoinedClient)} should only be invoked on a non-session owner client!");
23032288
return;
23042289
}
23052290
var localClientId = NetworkManager.LocalClient.ClientId;
@@ -2328,19 +2313,13 @@ internal void SynchronizeObjectsToNewlyJoinedClient(ulong newClientId)
23282313
{
23292314
if (!NetworkManager.DistributedAuthorityMode)
23302315
{
2331-
if (NetworkManager.LogLevel <= LogLevel.Error)
2332-
{
2333-
NetworkLog.LogError($"[Internal Error] {nameof(SynchronizeObjectsToNewlyJoinedClient)} should only be invoked when using a distributed authority network topology!");
2334-
}
2316+
Debug.LogError($"[Internal Error] {nameof(SynchronizeObjectsToNewlyJoinedClient)} should only be invoked when using a distributed authority network topology!");
23352317
return;
23362318
}
23372319

23382320
if (NetworkManager.NetworkConfig.EnableSceneManagement)
23392321
{
2340-
if (NetworkManager.LogLevel <= LogLevel.Error)
2341-
{
2342-
NetworkLog.LogError($"[Internal Error] {nameof(SynchronizeObjectsToNewlyJoinedClient)} should only be invoked when scene management is disabled!");
2343-
}
2322+
Debug.LogError($"[Internal Error] {nameof(SynchronizeObjectsToNewlyJoinedClient)} should only be invoked when scene management is disabled!");
23442323
return;
23452324
}
23462325

0 commit comments

Comments
 (0)