Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to clear dirty Playable Asset data?

Discussion in 'Timeline' started by seoyeon222222, Oct 29, 2023.

  1. seoyeon222222

    seoyeon222222

    Joined:
    Nov 18, 2020
    Posts:
    172
    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?
     
  2. wumu_

    wumu_

    Joined:
    Dec 11, 2023
    Posts:
    1
    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:https://forum.unity.com/threads/referencing-markers-from-clips.717098/
    And the link of plugin:https://github.com/mob-sakai/SubAssetEditor
    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.
    Code (CSharp):
    1. using UnityEngine.Timeline;
    2.     using UnityEngine;
    3.     using UnityEditor;
    4.     public class ShowSubAssets
    5.     {
    6.         [MenuItem("Assets/Show SubAssets of Timeline Asset")]
    7.         public static void ShowSubAssetsFunction()
    8.         {
    9.             Object selection = Selection.activeObject;
    10.             string assetPath = AssetDatabase.GetAssetPath(selection);
    11.             Object[] subAssets = AssetDatabase.LoadAllAssetsAtPath(assetPath);
    12.             Debug.Log($"subAssets length: {subAssets.Length}");
    13.             foreach (Object subAsset in subAssets)
    14.             {
    15.                 Debug.Log($"subAsset.name : {subAsset.name}; type: {subAsset.GetType()}");
    16.                 if (subAsset is Marker marker && marker.parent ==null)
    17.                 {
    18.                     // If it doesn't have parent, I think you want to delete it.
    19.                     Debug.Log($"{marker.name} doesn't have parent.");
    20.                    
    21.                 }else if (subAsset is TrackAsset markerTrack && markerTrack.parent ==null)
    22.                 {
    23.                     Debug.Log($"{markerTrack.name} doesn't have parent.");
    24.                 }
    25.             }
    26.         }
    27.     }