I’m trying to change the Connect Address and Connect Port properties of the NetworkManager from a script, but I can’t find any properties or methods to do so.
But this seems to belong to an old version of the NetworkManager, because:
a) I can’t find such properties.
b) “singleton” is not correctly capitalized.
c) Those post are from 2018.
This is probably a very silly question, but I’ve been searching for this for about an hour, and I still can’t find it.
The unityTransport.SetConnectionData() method has gone apparantly.
I tried this method:
private void ConfigureNetworkManager(string hostIPAddress)
{
Debug.Log("ConfigureNetworkManager");
// Assuming UnityTransport is attached to the NetworkManager GameObject
var unityTransport = NetworkManager.Singleton.GetComponent<UnityTransport>();
if (unityTransport != null)
{
// Set the IP address for the client to connect to
unityTransport.SetConnectionData(hostIPAddress, 7777); // Port should match the server's port
// Start the client
StartClient();
}
else
{
Debug.LogError("UnityTransport component not found on NetworkManager.");
}
}
However, calling NetworkManager.Singleton.StartClient(); afterwards does not work. (yet)