Set NetworkManager Connect Address and Connect Port from code

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.

I have found posts stating to do this:

NetworkManager.singleton.networkAddress = "192.168.1.18";
NetworkManager.singleton.networkPort = 7777;

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.

Finally I found it:

NetworkManager.Singleton.GetComponent<UNetTransport>().ConnectAddress = "192.168.1.100";
NetworkManager.Singleton.GetComponent<UNetTransport>().ConnectPort = 1234;

I had tried to do this but Visual Studio was not recognizing UNetTransport to me because I was missing:

using MLAPI.Transports.UNET;

What is MLAPI?
My Visual Studio don’t recognize MLAPI

MLAPI is the project that became Netcode for GameObjects, this post predates the change I guess. You can set the ip and port like this:

        private void InitialiseTransport(string ip, ushort port)
        {
            UnityTransport unityTransport = NetworkManager.Singleton.GetComponent<UnityTransport>();

            unityTransport.SetConnectionData(ip, port);
        }

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)