mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Fix sceneId assignment if scene not in build settings
This commit is contained in:
parent
5b187fe0df
commit
60c9cbd99a
@ -139,7 +139,15 @@ public static void OnPostProcessScene()
|
|||||||
// sceneId duplicates.
|
// sceneId duplicates.
|
||||||
// -> we need an offset to start at 1000+1,+2,+3, etc.
|
// -> we need an offset to start at 1000+1,+2,+3, etc.
|
||||||
// -> the most robust way is to split uint value range by sceneCount
|
// -> the most robust way is to split uint value range by sceneCount
|
||||||
uint offsetPerScene = uint.MaxValue / (uint)SceneManager.sceneCountInBuildSettings;
|
// -> only if more than one scene. otherwise use offset 0 to avoid
|
||||||
|
// DivisionByZero if no scene in build settings, and to avoid
|
||||||
|
// different offsets in editor/build if scene wasn't added to
|
||||||
|
// build settings.
|
||||||
|
uint offsetPerScene = 0;
|
||||||
|
if (SceneManager.sceneCountInBuildSettings > 1)
|
||||||
|
{
|
||||||
|
offsetPerScene = uint.MaxValue / (uint)SceneManager.sceneCountInBuildSettings;
|
||||||
|
}
|
||||||
|
|
||||||
// make sure that there aren't more sceneIds than offsetPerScene
|
// make sure that there aren't more sceneIds than offsetPerScene
|
||||||
if (identities.Count >= offsetPerScene)
|
if (identities.Count >= offsetPerScene)
|
||||||
|
Loading…
Reference in New Issue
Block a user