mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +00:00
Co-authored-by: mischa <info@noobtuts.com>
This commit is contained in:
parent
68c7d14a16
commit
c80a3c8ea5
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user