diff --git a/Assets/Mirror/Editor/NetworkScenePostProcess.cs b/Assets/Mirror/Editor/NetworkScenePostProcess.cs index 2fa07d65b..9baad1b90 100644 --- a/Assets/Mirror/Editor/NetworkScenePostProcess.cs +++ b/Assets/Mirror/Editor/NetworkScenePostProcess.cs @@ -55,19 +55,28 @@ public static void OnPostProcessScene() else { // there are two cases where sceneId == 0: - // * if we have a prefab open in the prefab scene - // * if an unopened scene needs resaving - // show a proper error message in both cases so the user - // knows what to do. + // if we have a prefab open in the prefab scene string path = identity.gameObject.scene.path; if (string.IsNullOrWhiteSpace(path)) + { + // pressing play while in prefab edit mode used to freeze/crash Unity 2019. + // this seems fine now so we don't need to stop the editor anymore. +#if UNITY_2020_3_OR_NEWER + Debug.LogWarning($"{identity.name} was open in Prefab Edit Mode while launching with Mirror. If this causes issues, please let us know."); +#else Debug.LogError($"{identity.name} is currently open in Prefab Edit Mode. Please open the actual scene before launching Mirror."); + EditorApplication.isPlaying = false; +#endif + } + // if an unopened scene needs resaving else - Debug.LogError($"Scene {path} needs to be opened and resaved, because the scene object {identity.name} has no valid sceneId yet."); + { - // either way we shouldn't continue. nothing good will - // happen when trying to launch with invalid sceneIds. - EditorApplication.isPlaying = false; + // nothing good will happen when trying to launch with invalid sceneIds. + // show an error and stop playing immediately. + Debug.LogError($"Scene {path} needs to be opened and resaved, because the scene object {identity.name} has no valid sceneId yet."); + EditorApplication.isPlaying = false; + } } } }