Closed Jayson-Furr closed 2 months ago
Hi @Jayson-Furr, I am having a hard time replicating this issue. In order to help determine what the issue could be, I have attached a small project that has a dedicated server profile and scripts that follow the same pattern you listed above. DSListenConfig.zip
What I am logging is:
When you open the sample scene and select the NetworkManager
in-scene placed GameObject
you will see both a NetworkManagerHelper
component and the UnityTransport
component. Within the NetworkManagerHelper
component there are two dedicated server specific properties, ListenAddress
and ListenPort
, that will be used to override the UnityTransport's settings.
Within the NetworkManagerHelper
script file, you will find the StartDedicatedServer
method that contains the following script:
Debug.Log($"[Pre-Init] Server Address Endpoint: {NetworkManager.Singleton.GetComponent<UnityTransport>().ConnectionData.ServerEndPoint}");
Debug.Log($"[Pre-Init] Server Listen Endpoint: {NetworkManager.Singleton.GetComponent<UnityTransport>().ConnectionData.ListenEndPoint}");
// Setup your IP and port sepcific to your DGS
unityTransport.SetConnectionData(ListenAddress, ListenPort, ListenAddress);
Debug.Log($"[Post-Init] Server Address Endpoint: {NetworkManager.Singleton.GetComponent<UnityTransport>().ConnectionData.ServerEndPoint}");
Debug.Log($"[Post-Init] Server Listen Endpoint: {NetworkManager.Singleton.GetComponent<UnityTransport>().ConnectionData.ListenEndPoint}");
Then you will find within the OnServerStarted
method (below the StartDedicatedServer
method) the following script that logs the endpoint settings once the dedicated server is started:
Debug.Log("Dedicated Server Started!");
Debug.Log($"[Started] Server Address Endpoint: {NetworkManager.Singleton.GetComponent<UnityTransport>().ConnectionData.ServerEndPoint}");
Debug.Log($"[Started] Server Listen Endpoint: {NetworkManager.Singleton.GetComponent<UnityTransport>().ConnectionData.ListenEndPoint}");
Could verify this works as expected for you and then see if there might be any differences between your project and the one included? If you do find any large differences between the two, could you modify the included project to replicate the issue you are experiencing so I can then try to replicate the issue on my end?
Noel, I located this just earlier and realized that this package was overwriting my values and now see it is working as intended to. I was not immediately aware that the dedicated server package already did this and was attempting to implement it own my own.
You can close this as it is not an issue.
Thanks again!
Description
A clear and concise description of what the bug is when I use the following code and compile it to a Windows Dedicated Server platform build the default address and port are used instead of the set address and port. This does not happen when running in the editor, only when I build and run the binaries. If I use the code and compile it to a Windows platform build, everything works fine.
` NetworkManager.Singleton.GetComponent().SetConnectionData("127.0.0.1", 57111);
Debug.Log($"Server Address Endpoint: {NetworkManager.Singleton.GetComponent().ConnectionData.ServerEndPoint.ToString()}");
Debug.Log($"Server Listen Endpoint: {NetworkManager.Singleton.GetComponent().ConnectionData.ListenEndPoint.ToString()}");
Debug.Log("Server Manager Starting Server."); NetworkManager.Singleton.StartServer();
Debug.Log($"Server Address Endpoint: {NetworkManager.Singleton.GetComponent().ConnectionData.ServerEndPoint.ToString()}");
Debug.Log($"Server Listen Endpoint: {NetworkManager.Singleton.GetComponent().ConnectionData.ListenEndPoint.ToString()}");
`
Reproduce Steps
Actual Outcome
The default address, 127.0.0.1, and the default port, 7777, are used.
Expected Outcome
The set address, 127.0.0.1, and the set port, 57111, should be used.
Environment