- Home /
Unity Networking Errors
I cannot seem to get the unity networking thing to work correctly. When I start a start a server and try to connect to it, it gives me the error: NAT target 127 not connected to NAT facilitator 25.181.197.205:50005. I have searched all over unity answers for the fix. I tried creating my own master server and facilitator, turning NAT off, and changing the connection IP to various other IP addresses that may have worked, all to no avail. Please, if anyone has fixed this problem share your solution. Here is my server and client code:
if (Network.peerType == NetworkPeerType.Disconnected) {
// host server
hostName = GUI.TextField(new Rect(Screen.width * 0.7f, Screen.height * 0.7f - Screen.height/10 - 60, Screen.width/7, 20), hostName);
GUI.Label(new Rect(Screen.width * 0.7f - 41, Screen.height * 0.7f - Screen.height/10 - 60, Screen.width/7, 20), "Name: ");
comment = GUI.TextField(new Rect(Screen.width * 0.7f, Screen.height * 0.7f - Screen.height/10 - 40, Screen.width/7, 20), comment);
GUI.Label(new Rect(Screen.width * 0.7f - 63, Screen.height * 0.7f - Screen.height/10 - 40, Screen.width/7 + 63, 20), "Comment: ");
connections = GUI.TextField(new Rect(Screen.width * 0.7f, Screen.height * 0.7f - Screen.height/10 - 20, Screen.width/7, 20), connections);
GUI.Label(new Rect(Screen.width * 0.7f - 80, Screen.height * 0.7f - Screen.height/10 - 20, Screen.width/7 + 100, 20), "Max Players: ");
port = GUI.TextField(new Rect(Screen.width * 0.7f, Screen.height * 0.7f - Screen.height/10, Screen.width/7, 20), port);
GUI.Label(new Rect(Screen.width * 0.7f - 30, Screen.height * 0.7f - Screen.height/10, Screen.width/7, 20), "Port: ");
try {
port1 = int.Parse(port);
connections1 = int.Parse(connections);
} catch {
GUI.Label(new Rect(Screen.width * 0.7f + 100, Screen.height * 0.6f - Screen.height/10 - 20, Screen.width/10, 80), "Port and Max Players Must be Integers");
}
if (GUI.Button(new Rect(Screen.width * 0.7f, Screen.height * 0.7f, Screen.width/5, Screen.height/5), "Make Server")) {
Network.InitializeServer(connections1, port1, true);
}
// join server
portToConnect = GUI.TextField(new Rect(Screen.width * 0.2f, Screen.height * 0.7f - Screen.height/10, Screen.width/7, 20), portToConnect);
GUI.Label(new Rect(Screen.width * 0.2f - 30, Screen.height * 0.7f - Screen.height/10, Screen.width/7, 20), "Port: ");
ip = GUI.TextField(new Rect(Screen.width * 0.2f, Screen.height * 0.7f - Screen.height/10 - 20, Screen.width/7, 20), ip);
GUI.Label(new Rect(Screen.width * 0.2f - 20, Screen.height * 0.7f - Screen.height/10 - 20, Screen.width/7, 20), "IP: ");
if (GUI.Button(new Rect(Screen.width * 0.15f, Screen.height * 0.7f, Screen.width/5, Screen.height/5), "Join Server")) {
try {
Network.Connect(ip, portToConnect);
} catch {
failed = true;
}
}
if (failed) {
GUI.Label(new Rect(Screen.width * 0.2f - 30 - 50, Screen.height * 0.7f - Screen.height/10, Screen.width/7, 20), "Unknown Server");
Debug.Log("Failed");
}
}
Answer by Seizure · Aug 21, 2013 at 08:40 PM
In Unity3D GOTO: Edit -> Project Settings -> Editor
In the inspector window: WWW Security Emulation Setting Host URL: (your server's ip address)
I have just now tried that and got the same error message, but thanks for the help.
Your answer
![](https://koobas.hobune.stream/wayback/20220613112705im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
"Strange behaviour may occur" when using Network.AllocateViewID() 0 Answers
Choose Player UNet Problem with Client 0 Answers
Distribute terrain in zones 3 Answers
Why is networkbehaviour underlined in green? 1 Answer
Server still sending Packets to inactive clients and throwing errors. How can I stop it? 0 Answers