Connect on Lan


I’m creating a MP game that i need to run on a local network, i got this to work using Network.Connect. the problem with this is since I’m working on a local network i should have to port forward a port for players that’s also on the lan to connect to me.

Is there a way to connect to some one on a lan network without having to port forward when using unity’s Network…InitializeServer?

There is indeed!

var port : float = 25565;
Network.InitializeServer(32, port, !Network.HavePublicAddress());

Then make another client connect when he is for instance pressing a button.

			if (GUI.Button (Rect (Screen.width /2-70,Screen.height / 2 + 40 ,70,20), "Connect"))

				Network.Connect(ip, port);

Let me know if i am not clear, this works fine for me over almost every network i use, bot hamachi, school and home.