Hey everybody, this is probably a pretty common issue but I didn’t know what to search for so I decided to ask here. Anyway, I’m wondering how you get the host data from a server you just initialized. For example after I use the code
Network.InitializeServer(2, 25002, false);
MasterServer.RegisterHost(GameID, “ORR TEST”, “Test”);
what goes next so I can then get the host data?
I found that post from Iarus:
HostData objects are sent by the master server and thats separate from the Network Manager himself. You manually take the data from a HostData object, the IP and port, and use that in Network.Connect(). There is now way for Unity to know which HostData object from MasterServer.PollHostList you used when connecting.
If you want to keep around the HostData object you should store the one you are using yourself.
To get IP and port info on the current server the client is connected to you can use “Network.connections”. On clients the only connection in that list is the one with the server.