How to clear dirty Playable Asset data?

There is a PlayableAsset that used to use Custom Track and Custom Clip.
I deleted the related script(Custom Track, Clip)
And I can no longer see the elements related to it on PlayableAsset.

This causes the following warning.

“The referenced script (Unknown) on this Behaviour is missing!”

In fact, if i open a Playable file through Text Editor and read YAML,
There’s a lot of dirty data that i don’t use.
This seems to be causing an error.
I want to delete the Dirty data that are not actually used.
But in unity editor, i can’t see any element of dirty things.
i try AssetDatabase.ForceReserializeAsets and Reimport, but does not resolve.

How do I solve this problem?

Because unity hides the timeline’s sub-assets by default, they are ScriptableObjects. you can view them through some plugins or show them through code.
Here is the link: Referencing Markers from Clips
And the link of plugin:GitHub - mob-sakai/SubAssetEditor: Editor for SubAsset in unity project.
I recommend using the plugin I mentioned, but here is code to log subAssets.
Just right click the timeline in the project view and select “Show SubAssets of Timeline Asset” from the context menu.

using UnityEngine.Timeline;
    using UnityEngine;
    using UnityEditor;
    public class ShowSubAssets
    {
        [MenuItem("Assets/Show SubAssets of Timeline Asset")]
        public static void ShowSubAssetsFunction()
        {
            Object selection = Selection.activeObject;
            string assetPath = AssetDatabase.GetAssetPath(selection);
            Object[] subAssets = AssetDatabase.LoadAllAssetsAtPath(assetPath);
            Debug.Log($"subAssets length: {subAssets.Length}");
            foreach (Object subAsset in subAssets)
            {
                Debug.Log($"subAsset.name : {subAsset.name}; type: {subAsset.GetType()}");
                if (subAsset is Marker marker && marker.parent ==null)
                {
                    // If it doesn't have parent, I think you want to delete it.
                    Debug.Log($"{marker.name} doesn't have parent.");
                   
                }else if (subAsset is TrackAsset markerTrack && markerTrack.parent ==null)
                {
                    Debug.Log($"{markerTrack.name} doesn't have parent.");
                }
            }
        }
    }
1 Like