- Home /
Question by
AxisRob · May 14, 2014 at 12:21 PM ·
networkloadlevelapplication.loadlevel
Network Level Loading Freezes Everything
Unity version 4.3.3f1
Long story short: I have two connected players playing a game.
Then I try to load like this:
The call is done by an RPC, and all the code executes perfectly up to this point: networkView.RPC("WinScreenGo", RPCMode.All);
//
//
[RPC]
void WinScreenGo()
{
Debug.Log("RPC Received");
NetworkLevelLoader.Instance.Loadlevel("WinScreen");
}
public void Loadlevel(string levelName, int prefix = 0)
{
StopAllCoroutines();
if (prefix == 0)
{
levelLoadPrefix++;
prefix = levelLoadPrefix;
}
StartCoroutine(doLoadLevel(levelName, prefix));
}
IEnumerator doLoadLevel(string name, int prefix)
{
Network.SetSendingEnabled(0, false);
Network.isMessageQueueRunning = false;
Network.SetLevelPrefix(prefix);
Application.LoadLevel(name);
yield return null;
yield return null;
Network.isMessageQueueRunning = true;
Network.SetSendingEnabled(0, true);
}
It just straight up crashes. I tried to change the level that gets loaded, etc.
When I test with a debug log, I see that the " networkView.RPC("WinScreenGo", RPCMode.All);" gets loaded, but the next debug log doesn't even make it to the debugger before client and server freeze.
I've been stuck on this for weeks. Thoughts please?
Comment
Answer by AxisRob · May 14, 2014 at 12:59 PM
Also, "WinScreen" is spelled correctly, and this method loads into the level the players play in without issue