using UnityEngine;
using Unity.Netcode;
namespace Northbound
{
///
/// NetworkConfig의 모든 설정을 로그로 출력하여 서버/클라이언트 차이점을 확인
///
public class NetworkConfigDebugger : MonoBehaviour
{
[ContextMenu("Log NetworkConfig Details")]
public void LogNetworkConfig()
{
if (NetworkManager.Singleton == null)
{
Debug.LogError("[NetworkConfigDebugger] NetworkManager not found!");
return;
}
Debug.Log("=== NETWORK CONFIG DEBUGGER ===");
var config = NetworkManager.Singleton.NetworkConfig;
var transport = NetworkManager.Singleton.GetComponent();
Debug.Log("Basic Config:");
Debug.Log($" ProtocolVersion: {config.ProtocolVersion}");
Debug.Log($" TickRate: {config.TickRate}");
Debug.Log($" ClientConnectionBufferTimeout: {config.ClientConnectionBufferTimeout}");
Debug.Log($" EnsureNetworkVariableLengthSafety: {config.EnsureNetworkVariableLengthSafety}");
Debug.Log("Connection Settings:");
Debug.Log($" ConnectionApproval: {config.ConnectionApproval}");
Debug.Log($" EnableSceneManagement: {config.EnableSceneManagement}");
Debug.Log($" EnableNetworkLogs: {config.EnableNetworkLogs}");
Debug.Log("Spawn Settings:");
Debug.Log($" ForceSamePrefabs: {config.ForceSamePrefabs}");
Debug.Log($" RecycleNetworkIds: {config.RecycleNetworkIds}");
Debug.Log($" PlayerPrefab: {config.PlayerPrefab?.name ?? "NULL"}");
Debug.Log("NetworkPrefabs ({config.Prefabs.Prefabs.Count}):");
foreach (var prefab in config.Prefabs.Prefabs)
{
Debug.Log($" - {prefab.Prefab.name} (Hash: {prefab.Prefab.GetHashCode()})");
}
Debug.Log("Transport:");
if (transport != null)
{
Debug.Log($" Address: {transport.ConnectionData.Address}");
Debug.Log($" Port: {transport.ConnectionData.Port}");
Debug.Log($" ServerData: {transport.ConnectionData.ServerListenAddress}:{transport.ConnectionData.Port}");
}
else
{
Debug.LogError(" Transport not found!");
}
Debug.Log("================================");
}
}
}