Is there a way to change the port via script in Mirror

Idk if this should have been posted in scripting but since the question centers around Mirror I posted it here.

I have made my own HUD but I also want to let the Player change the port he is connecting to but I have struggled to find anything on that topic.
The documentation didn’t offer any help so if someone knows the answer I would be glad.

The port is on the transport component of the NetworkManager, you can change it in Unity editor or via a script.

This is an example of changing the port for the Telepathy Transport:

        GameObject.FindObjectOfType<NetworkManager>().GetComponent<TelepathyTransport>().port = 7000;
1 Like