From 3d715e80217d8ed9bd8293b4267c3562a4a9bb3c Mon Sep 17 00:00:00 2001 From: soul Date: Tue, 1 Dec 2026 07:54:32 +0100 Subject: [PATCH] Play capture leaves no tracked asset modified A run dirtied twelve tracked assets: eight render textures, the two gravity-lines materials, Stardust.mat (properties and descriptors set from code on assets loaded in play, saved by the exit) and the TMP fallback font asset. Finish now clears the dirty flag of every persistent loaded object before Exit, and logs which. The font asset is written by TMP's own EditorApplication.quitting callback (TMP_EditorResourceManager.cs:23), which clears the dynamic atlas of any dynamic font asset whose atlas is populated; the committed LiberationSans SDF - Fallback.asset still held a 536 KB populated atlas, so every Editor exit rewrote it. It is committed in the state that callback leaves (the same state, so the callback no longer writes). Co-Authored-By: Claude Sonnet 5.5 --- .../Scripts/Editor/InventoryPanelsPlayCapture.cs | 15 +++++++++++++++ .../LiberationSans SDF - Fallback.asset | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Editor/InventoryPanelsPlayCapture.cs b/Assets/Scripts/Editor/InventoryPanelsPlayCapture.cs index 339e17bb7..d099d7b48 100644 --- a/Assets/Scripts/Editor/InventoryPanelsPlayCapture.cs +++ b/Assets/Scripts/Editor/InventoryPanelsPlayCapture.cs @@ -96,9 +96,24 @@ public static class InventoryPanelsPlayCapture SessionState.SetBool(Flag, false); EditorSceneManager.playModeStartScene = null; Log(code == 0 ? "PASS" : "FAILED"); + ClearDirtyAssets(); EditorApplication.Exit(code); } + // A play session modifies the assets it loads (render texture descriptors, material properties set from code) and the exit saves them. + // The capture leaves the project as it found it: the dirty flag of every persistent object is cleared first, and logged by path. + private static void ClearDirtyAssets() + { + var cleared = new SortedSet(); + foreach (var asset in Resources.FindObjectsOfTypeAll()) + { + if (!EditorUtility.IsPersistent(asset) || !EditorUtility.IsDirty(asset)) continue; + EditorUtility.ClearDirty(asset); + cleared.Add(AssetDatabase.GetAssetPath(asset)); + } + Log($"cleared the dirty flag of persistent assets: {(cleared.Count == 0 ? "none" : string.Join(", ", cleared))}"); + } + private static void Require(bool condition, string what) { if (!condition) throw new InvalidOperationException("assertion failed: " + what); diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset index 4d9191d4c..4787be7c3 100644 --- a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset +++ b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f1eead45000fe0fe0a6fce50b4d21ab2ff1ea25f5b390452116e0b04f28540a7 -size 536050 +oid sha256:f53586850a70c4f308e7e71b99b63881a49f38de4bd40f4edb7fe7ae6ecf8a52 +size 9748