Skip to content

Commit f5967dc

Browse files
committed
Use new logger for the NetworkManager
1 parent ad003b7 commit f5967dc

File tree

4 files changed

+76
-95
lines changed

4 files changed

+76
-95
lines changed

com.unity.netcode.gameobjects/Editor/NetworkManagerEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ private void DisplayNetworkManagerProperties()
298298
#else
299299
string path = Path.Combine(directory, $"NetworkPrefabs-{m_NetworkManager.GetInstanceID()}.asset");
300300
#endif
301-
Debug.Log("Saving migrated Network Prefabs List to " + path);
301+
m_NetworkManager.Log.Info(new Context(LogLevel.Normal, "Saving migrated Network Prefabs List").With("Path", path));
302302
AssetDatabase.CreateAsset(networkPrefabs, path);
303303
EditorUtility.SetDirty(m_NetworkManager);
304304
}

com.unity.netcode.gameobjects/Editor/NetworkManagerHelper.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,17 @@ public void CheckAndNotifyUserNetworkObjectRemoved(NetworkManager networkManager
162162

163163
if (!EditorApplication.isPlaying && !editorTest)
164164
{
165-
EditorUtility.DisplayDialog($"Removing {nameof(NetworkObject)}", NetworkManagerAndNetworkObjectNotAllowedMessage(), "OK");
165+
EditorUtility.DisplayDialog($"Removing {nameof(NetworkObject)}", k_NetworkManagerAndNetworkObjectNotAllowedMessage, "OK");
166166
}
167167
else
168168
{
169-
Debug.LogError(NetworkManagerAndNetworkObjectNotAllowedMessage());
169+
networkManager.Log.Error(new Context(LogLevel.Error, k_NetworkManagerAndNetworkObjectNotAllowedMessage));
170170
}
171171
}
172172
}
173173

174-
public string NetworkManagerAndNetworkObjectNotAllowedMessage()
175-
{
176-
return $"A {nameof(GameObject)} cannot have both a {nameof(NetworkManager)} and {nameof(NetworkObject)} assigned to it or any children under it.";
177-
}
174+
private static readonly string k_NetworkManagerAndNetworkObjectNotAllowedMessage = $"A {nameof(GameObject)} cannot have both a {nameof(NetworkManager)} and {nameof(NetworkObject)} assigned to it or any children under it.";
175+
public string NetworkManagerAndNetworkObjectNotAllowedMessage() => k_NetworkManagerAndNetworkObjectNotAllowedMessage;
178176

179177
/// <summary>
180178
/// Handles notifying the user, via display dialog window, that they have nested a NetworkManager.
@@ -215,7 +213,7 @@ public bool NotifyUserOfNestedNetworkManager(NetworkManager networkManager, bool
215213
}
216214
else
217215
{
218-
Debug.LogError(message);
216+
networkManager.Log.Error(new Context(LogLevel.Error, message));
219217
}
220218

221219
if (!s_LastKnownNetworkManagerParents.ContainsKey(networkManager) && isParented)

0 commit comments

Comments
 (0)