com.unity.netcode.gameobjects
com.unity.netcode.gameobjects copied to clipboard
Bind to a specific ip address when starting the server (there are several of them on the server). How?
maybe in public class UNetTransport : NetworkTransport
public string ServerBindAddress = "";
public override bool StartServer()
{
var topology = new HostTopology(GetConfig(), MaxConnections);
if (ServerBindAddress != "")
{
UnityEngine.Networking.NetworkTransport.AddHost(topology, ServerListenPort, ServerBindAddress);
}
else
{
UnityEngine.Networking.NetworkTransport.AddHost(topology, ServerListenPort, null);
}
return true;
}
or
create new method like:
public string ServerBindAddress = "";
public override bool StartServerAndBind()
{
var topology = new HostTopology(GetConfig(), MaxConnections);
{
UnityEngine.Networking.NetworkTransport.AddHost(topology, ServerListenPort, ServerBindAddress);
}
return true;
}
Or is there another way?
it will be very helfull!