Every time the editor enters playmode, the SceneGuidRegistry object gets updated. This is more of a QoL issue, particularly when using git to track changes - the scene would show changes even when nothing has been modified. The issue seems to stem from GuidRegistryUpdater.UpdateScenesGuidRegistry in the Unity-Runtime-GUID package. The order of the objects returned by unity is not the same each time, which results in the above behaviour. A simple fix is to order the scene objects after querying the scene before updating/validating the SceneGuidRegistry:
diff --git a/Editor/GuidRegistryUpdater.cs b/Editor/GuidRegistryUpdater.cs
index f86f64f..17f5024 100644
--- a/Editor/GuidRegistryUpdater.cs
+++ b/Editor/GuidRegistryUpdater.cs
@@ -148,6 +148,10 @@ namespace UnityRuntimeGuid.Editor
sceneObjects.AddRange(EditorUtility.CollectDependencies(scene.GetRootGameObjects())
.Where(dependency => dependency != null));
+ // The order of the objects added is not the same everytime sceneObjects is populated.
+ // This prevents the SceneGuidRegistry being updated at each bild/playModeStateChanged.
+ sceneObjects = sceneObjects.OrderBy(o => o.GetHashCode()).ToList();
+
foreach (var sceneObject in sceneObjects.Where(sceneObject => !IsAsset(sceneObject)))
{
if (sceneObject.GetType().Namespace == typeof(UnityEditor.Editor).Namespace)
Every time the editor enters playmode, the SceneGuidRegistry object gets updated. This is more of a QoL issue, particularly when using git to track changes - the scene would show changes even when nothing has been modified. The issue seems to stem from
GuidRegistryUpdater.UpdateScenesGuidRegistryin the Unity-Runtime-GUID package. The order of the objects returned by unity is not the same each time, which results in the above behaviour. A simple fix is to order the scene objects after querying the scene before updating/validating theSceneGuidRegistry: