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 <noreply@anthropic.com>
This commit is contained in:
parent
8ee198ef02
commit
3d715e8021
2 changed files with 17 additions and 2 deletions
|
|
@ -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<string>();
|
||||
foreach (var asset in Resources.FindObjectsOfTypeAll<UnityEngine.Object>())
|
||||
{
|
||||
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);
|
||||
|
|
|
|||
BIN
Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset
(Stored with Git LFS)
BIN
Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in a new issue