fix: IsSpawnedObjectsPendingInDontDestroyOnLoad should only be set when LoadSceneMode.Single (#2330)

* fix
MTT-4681
this fix assures that IsSpawnedObjectsPendingInDontDestroyOnLoad is only set to true when LoadSceneMode = LoadSceneMode.Singleonly.

* update
updating changelog.
This commit is contained in:
Noel Stephens 2022-12-02 11:54:51 -06:00 коммит произвёл GitHub
Родитель d9ab3a7ffb
Коммит 8e348c1e0f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 8 добавлений и 11 удалений

Просмотреть файл

@ -34,7 +34,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
- Optimized bandwidth usage by encoding most integer fields using variable-length encoding. (#2276)
### Fixed
- Fixed `IsSpawnedObjectsPendingInDontDestroyOnLoad` is only set to true when loading a scene using `LoadSceneMode.Singleonly`. (#2330)
- Fixed issue where `NetworkTransform` components nested under a parent with a `NetworkObject` component (i.e. network prefab) would not have their associated `GameObject`'s transform synchronized. (#2298)
- Fixed issue where `NetworkObject`s that failed to instantiate could cause the entire synchronization pipeline to be disrupted/halted for a connecting client. (#2298)
- Fixed issue where in-scene placed `NetworkObject`s nested under a `GameObject` would be added to the orphaned children list causing continual console warning log messages. (#2298)

Просмотреть файл

@ -862,16 +862,6 @@ namespace Unity.Netcode
SceneEventProgressTracking.Add(sceneEventProgress.Guid, sceneEventProgress);
if (!isUnloading)
{
// The Condition: While a scene is asynchronously loaded in single loading scene mode, if any new NetworkObjects are spawned
// they need to be moved into the do not destroy temporary scene
// When it is set: Just before starting the asynchronous loading call
// When it is unset: After the scene has loaded, the PopulateScenePlacedObjects is called, and all NetworkObjects in the do
// not destroy temporary scene are moved into the active scene
IsSpawnedObjectsPendingInDontDestroyOnLoad = true;
}
m_IsSceneEventActive = true;
// Set our callback delegate handler for completion
@ -1162,6 +1152,13 @@ namespace Unity.Netcode
if (sceneEventData.LoadSceneMode == LoadSceneMode.Single)
{
// The Condition: While a scene is asynchronously loaded in single loading scene mode, if any new NetworkObjects are spawned
// they need to be moved into the do not destroy temporary scene
// When it is set: Just before starting the asynchronous loading call
// When it is unset: After the scene has loaded, the PopulateScenePlacedObjects is called, and all NetworkObjects in the do
// not destroy temporary scene are moved into the active scene
IsSpawnedObjectsPendingInDontDestroyOnLoad = true;
// Destroy current scene objects before switching.
m_NetworkManager.SpawnManager.ServerDestroySpawnedSceneObjects();