- Home /
Network.Connect literally does nothing
I have a script that connects a player to a server. I was in the middle of debugging the RPC call for loading a level, and all of the sudden my Network.Connect function started doing nothing at all, but the level doesn't load. It sends all of the debug calls but no errors are called nor does it load the new level. I can't tell if it's a problem with my connection script or RPC call, so here's both:
function JoinGame(){
connectingPass = joinPassBox.GetComponent("Text").text;
ipAddress = ipBox.GetComponent("Text").text;
initialPort = joinPortBox.GetComponent("Text").text;
connectingPort = parseFloat(initialPort);
Port = parseInt(connectingPort);
Debug.Log("Joining...");
Network.Connect(ipAddress, Port, connectingPass);
Debug.Log("Joined!");
}
@RPC
function Level(level : String){
Application.LoadLevel(level);
Debug.Log("Loaded!");
}
function OnPlayerConnected(player: NetworkPlayer){
Debug.Log("Connected a new player!");
Debug.Log("Player " + playerCount + " connected from " + player.ipAddress + ":" + player.port);
networkView.RPC("Level", player, Application.LoadedLevel);
}
Please help! Thanks in advance.
Answer by RadioactiveTechnologies · Nov 24, 2014 at 08:44 AM
Try restarting your computer, it may be your firewall getting in the way.
Answer by delorean225 · Dec 07, 2014 at 01:31 PM
In the end I was able to solve the issue; It seems that when my network was upgraded to a new router my port was mistyped and going to the wrong machine. Thanks for the help!
Your actual problem is that you don't check the return value of Network.Connect. If you do, you would get an NetworkConnectionError.
Your answer
![](https://koobas.hobune.stream/wayback/20220613172258im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Network ipAddress always 0.0.0.0 on PC, correct everywhere else. 3 Answers
4g network connection? 0 Answers
Cannot connect directly in local network 0 Answers
OnConnectedToServer called multiple times 1 Answer
networking Chat 1 Answer