Skip to content

Commit c1e37d2

Browse files
committed
Fix exception calling add twice
1 parent 564ed9b commit c1e37d2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

com.unity.netcode.gameobjects/Runtime/SceneManagement/NetworkSceneManager.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,14 +719,17 @@ internal void GenerateScenesInBuild()
719719
/// <summary>
720720
/// Register scene from outside of build (e.g. from an Addressables group).
721721
/// </summary>
722-
/// <param name="scenePaths">The paths of the external scenes to register.</param>
722+
/// <param name="addressablePath">The addressable path to the scene</param>
723+
/// <param name="editorScenePath">The asset path to the scene</param>
723724
public void RegisterAddressableScene(string addressablePath, string editorScenePath)
724725
{
725726
Debug.Log($"Registering addressable scene: {addressablePath} with editor scene path: {editorScenePath}");
726727
var hash = XXHash.Hash32(addressablePath);
727-
HashToAddressableName.Add(hash, addressablePath);
728-
AddressableNameOrScenePathToHash.Add(editorScenePath, hash);
729-
AddressableNameOrScenePathToHash.Add(addressablePath, hash);
728+
HashToAddressableName[hash] = addressablePath;
729+
730+
// We add both here because scene.path can be different in editor and in build, depending on addressable naming settings.
731+
AddressableNameOrScenePathToHash[editorScenePath] = hash;
732+
AddressableNameOrScenePathToHash[addressablePath] = hash;
730733
}
731734

732735
/// <summary>

0 commit comments

Comments
 (0)