PunSceneSettings and Application.loadedLevelName

Options
Hey,

For some reason Application.loadedLevelName is not giving the level while not playing and just editing the scene.
It gives a random scene or empty/null. This was causing me a lot of problems and I hot fixed it here, now all my in-scene prefabs are ok.

I changed the code in PhotonViewHandler from:
		int minViewIdInThisScene = PunSceneSettings.MinViewIdForScene(Application.loadedLevelName);
to:
		string levelName = Application.loadedLevelName;
#if UNITY_EDITOR
		levelName = System.IO.Path.GetFileNameWithoutExtension(EditorApplication.currentScene);
#endif
		int minViewIdInThisScene = PunSceneSettings.MinViewIdForScene(levelName);

Comments

  • Tobias
    Options
    Thanks for the heads up. I will have to take another look at this.
    Sorry it's causing extra effort. I hope the system is (now) useful for you?
  • Tobias
    Options
    This will be in PUN 1.29 (which should be the next update).
    Thanks again.