public void Update(List <LiveLinkChangeSet> changeSets, NativeList <Hash128> loadScenes, NativeList <Hash128> unloadScenes, LiveLinkMode mode) { if (_LoadedScenes.Count == 0 && _SceneGUIDToLiveLink.Count == 0 && _RemovedScenes.Length == 0) { return; } // If build configuration changed, we need to trigger a full conversion if (_BuildConfigurationGUID != default) { var buildConfigurationDependencyHash = AssetDatabaseCompatibility.GetAssetDependencyHash(_BuildConfigurationGUID); if (_BuildConfigurationArtifactHash != buildConfigurationDependencyHash) { _BuildConfigurationArtifactHash = buildConfigurationDependencyHash; RequestCleanConversion(); } } if (_PreviousGlobalDirtyID != GlobalDirtyID) { RequestCleanConversion(); _PreviousGlobalDirtyID = GlobalDirtyID; } // By default all scenes need to have m_GameObjectSceneCullingMask, otherwise they won't show up in game view _GUIDToEditScene.Clear(); for (int i = 0; i != EditorSceneManager.sceneCount; i++) { var scene = EditorSceneManager.GetSceneAt(i); var sceneGUID = AssetDatabaseCompatibility.PathToGUID(scene.path); if (_LoadedScenes.Contains(sceneGUID)) { if (scene.isLoaded && sceneGUID != default(GUID)) { _GUIDToEditScene.Add(sceneGUID, scene); } } } foreach (var scene in _SceneGUIDToLiveLink) { if (!_GUIDToEditScene.ContainsKey(scene.Key)) { unloadScenes.Add(scene.Key); } } // Process scenes that are no longer loaded foreach (var scene in unloadScenes) { var liveLink = _SceneGUIDToLiveLink[scene]; liveLink.Dispose(); _SceneGUIDToLiveLink.Remove(scene); _SentLoadScenes.Remove(scene); } foreach (var scene in _RemovedScenes) { if (_SceneGUIDToLiveLink.TryGetValue(scene, out var liveLink)) { liveLink.Dispose(); _SceneGUIDToLiveLink.Remove(scene); } unloadScenes.Add(scene); _SentLoadScenes.Remove(scene); } _RemovedScenes.Clear(); _SentLoadScenes.RemoveWhere(scene => !_LoadedScenes.Contains(scene)); // Process all scenes that the player needs var conversionMode = LiveConversionSettings.Mode; foreach (var sceneGuid in _LoadedScenes) { var isLoaded = _GUIDToEditScene.TryGetValue(sceneGuid, out var scene); // We are editing with live link. Ensure it is active & up to date if (isLoaded) { var liveLink = GetLiveLink(sceneGuid); if (liveLink == null || liveLink.DidRequestUpdate()) { AddLiveLinkChangeSet(ref liveLink, sceneGuid, changeSets, mode); } #if !UNITY_2020_2_OR_NEWER else if (liveLink.LiveLinkDirtyID != GetSceneDirtyID(scene)) { AddLiveLinkChangeSet(ref liveLink, sceneGuid, changeSets, mode); } #endif #if UNITY_2020_2_OR_NEWER if (conversionMode == LiveConversionSettings.ConversionMode.IncrementalConversionWithDebug) { if (liveLink != null && liveLink.DidRequestDebugConversion()) { if (IsHotControlActive()) { EditorUpdateUtility.EditModeQueuePlayerLoopUpdate(); } else { liveLink.DebugIncrementalConversion(); } } } #endif } else { if (_SentLoadScenes.Add(sceneGuid)) { loadScenes.Add(sceneGuid); } } } }