Detected issue with Unity 5.4 - Changing scene - OnLevelWasLoaded() method

Options
In Unity 5.4, OnLevelWasLoaded() method has been deprecated. Photon Engine knows this and has commented the method OnLevelWasLoaded() located at PhotonHandler.cs. However this causes that the method NewSceneLoaded() in NetworkingPeer.cs is never called and the network mesage-queue is not enabled again as it's stated in the documentation of LoadLevel():

While loading levels, it makes sense to not dispatch messages received by other players. This method takes care of that by setting PhotonNetwork.isMessageQueueRunning = false and enabling the queue when the level was loaded.

I suppose this will be solved in the future but as now, the solution is emulate the OnLevelWasLoaded method:
		void OnLevelWasLoadedFixed(Scene scene, LoadSceneMode loadSceneMode){
			PhotonNetwork.networkingPeer.NewSceneLoaded();
			PhotonNetwork.networkingPeer.SetLevelInPropsIfSynced(SceneManagerHelper.ActiveSceneName);
		}
And call it using:

SceneManager.sceneLoaded += OnLevelWasLoadedFixed;

Hope it helps!

Comments

  • jeanfabre
    Options
    Hi,

    Thanks for this post. We'll look at this.

    Bye,

    Jean
  • jeanfabre
    Options
    Hi,

    This was identified and will be available as a fix in the next update.

    thanks for your report :)

    Bye,

    Jean