Personally, I can’t stand cloud hosted servers that I don’t get to set up myself. Due to this, I didn’t want to use Unity Multiplayer but I liked the ease of use of Unet. Due to this I did a bunch of reading on how I could get around it.
In the end I found this forum post:
Forum Post
Which offered an interesting solution, To use Mono.NAT to preform a nat punch through on a lan game and then set up a custom server list. Now the tutorials linked on how to set up mono.NAT are very straight forward but I am unsure as to where abouts I need to put the code?
I assume its somewhere in the network manager script but I don’t know where exactly.
Any help is greatly appreciated.
Signed,
Vandie
Ok turns out that all I had to do was create a new c# file that was purely the following code:
using Mono.Nat;
public class punchthrough {
public punchthrough(){
NatUtility.DeviceFound += DeviceFound;
NatUtility.DeviceLost += DeviceLost;
NatUtility.StartDiscovery ();
}
private void DeviceFound(object sender, DeviceEventArgs args)
{
INatDevice device = args.Device;
device.CreatePortMap(new Mapping(Protocol.Tcp, 2033, 2033));
// on device found code
}
private void DeviceLost(object sender, DeviceEventArgs args)
{
INatDevice device = args.Device;
device.DeletePortMap(new Mapping(Protocol.Tcp, 2033, 2033));
// on device disconnect code
}
}
I sent the file to a few others and it appears to punch through fine on port 2033
Hi. I just startet to look into Mono.NAT.
Once the port map is done, do I host the server on the internal IP (I create the port mapping like this: device.CreatePortMap(new Mapping(Protocol.Tcp, 25000, 25000))
(or just 127.0.0.1) and then tell people to connect through the IP I get from device.GetExternalIP().ToString()?
Thanks in advance 