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.