fix: Port log for when Server has started and is listening. (#3642)

Allows users to know if Server has actually started and which port, and not just initialised.
Credits to Gadget for code and suggesting to have it in NetworkServer.
(Originally was going in KCP-only)
This commit is contained in:
JesusLuvsYooh 2023-11-06 12:56:31 +00:00 committed by GitHub
parent 1641bba5b1
commit b195cc062a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,6 +122,17 @@ public static void Listen(int maxConns)
active = true;
RegisterMessageHandlers();
if (Transport.active is PortTransport portTransport)
{
#if UNITY_SERVER
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"Server listening on port {portTransport.Port}");
Console.ResetColor();
#else
Debug.Log($"Server listening on port {portTransport.Port}");
#endif
}
}
// initialization / shutdown ///////////////////////////////////////////