Compare commits

...

3 Commits

Author SHA1 Message Date
max
8453143918 Comment 2023-08-10 22:27:10 +02:00
max
1b9c367221 Prevent 'scene changed on disk' popup
Prevent 'scene changed on disk' popup when loading/additive loading.
2023-08-10 22:24:10 +02:00
max
4fe602e932 Save scene on save
- Check if the user wants to save the dirty scene on save
2023-08-10 21:41:57 +02:00

View File

@ -92,7 +92,7 @@ private void LoadScenePartitions(SortedSet<ulong> partitionIds)
// Add always load ids. // Add always load ids.
SortedSet<ulong> baseIds = GetAlwaysLoadIds(); SortedSet<ulong> baseIds = GetAlwaysLoadIds();
foreach (var id in baseIds) foreach (ulong id in baseIds)
{ {
partitionIds.Add(id); partitionIds.Add(id);
} }
@ -129,6 +129,8 @@ private void LoadScenePartitions(SortedSet<ulong> partitionIds)
} }
AssetDatabase.Refresh(); AssetDatabase.Refresh();
// 'Reload' the scene to prevent the user getting the popup 'Scene has been changed on disk'.
EditorSceneManager.OpenScene(scenePath, OpenSceneMode.Single);
} }
} }
@ -139,6 +141,9 @@ public void Save()
{ {
using (new ProfilerUtility.ProfilerScope($"{nameof(Save)}")) using (new ProfilerUtility.ProfilerScope($"{nameof(Save)}"))
{ {
// Check if the user wants to save the scene if dirty.
if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) return;
DeleteLoadedPartitions(); // Delete the loaded partitions from disk so we can write the new ones. DeleteLoadedPartitions(); // Delete the loaded partitions from disk so we can write the new ones.
string pattern = @"&(\d+)"; string pattern = @"&(\d+)";