Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Network.LoadLevel() not working (urgent)

$
0
0
I'm currently trying to program transitions between games. Once a game ends, a RPC is sent out to tell all clients to re-enter my "match lobby" menu while still in the level that ended. (I'm completely re-using the match lobby menu from the main menu, and just throwing it in at the end of the game)

When the masterclient hits a "start match" button it calls Network.LoadLevel(), the same way it does when starting a match from the main menu. However, only the masterclient's level loads--the others stay frozen in the last scene and only see various state updates. In other words, "OnLevelWasLoaded()" is never triggered on the other client's games.

Any ideas why this might happen? I've also noticed some warnings from Photon on the masterclient's side, like receiving OnSerialization for nonexistent views.

I'm close to a deadline, so would I be able to work around this temporarily by doing manual level loading? (by sending out an rpc to load a level and pausing the message queue)
    [RPC]
    void EndGame(string conclusionString)
    {
        conclusion = conclusionString;
        GameObject.FindGameObjectWithTag("HUD").GetComponentInChildren<MenuManagerScript>().GoToMenu((int)HUDMenuScript.MenuName.LOBBY);
    }

void Update()
{
//...
            //check for end of game
            if (timeLimit > 0 && ((Time.time - (float)room.customProperties["st"]) > timeLimit))
            {
                room.SetCustomProperties(new Hashtable { { "on", false } });
                PhotonNetwork.RemoveAllBufferedMessages();
                PhotonNetwork.RemoveAllInstantiatedObjects();
                photonView.RPC("EndGame", PhotonTargets.All, "The game has ended...");
            }
//...
}

//elsewhere
void OnGUI()
{
if (PhotonNetwork.isMasterClient)
        {
            if(GUI.Button(new Rect(50, Screen.height - 120, 90, 70), "Start Match"))
            {
                PhotonNetwork.room.SetCustomProperties(new Hashtable { { "st", Time.time } });
                PhotonNetwork.LoadLevel("blahblahblahPlaygroundScene");
            }
}
}

Thanks!
-Scott

Viewing all articles
Browse latest Browse all 15755

Latest Images

Trending Articles



Latest Images