Search Unity

Bug AudioTrack not removed from meta when deleted?

Discussion in 'Timeline' started by CDF, Mar 31, 2021.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    Hopefully will get around to submitting a bug report.
    But recently found a hard to track asset duplication issue using Addressables.
    At some point:
    • A timeline had an AudioTrack that referenced an AudioClip
    • Later the AudioTrack was deleted and the AudioClip made addressable
    • The Timeline asset still contains a AudioTrack in the asset meta and a reference to the clip
    • Only way to delete the AudioClip reference was to delete the meta defining the track.
    Timeline before manually deleting meta:
    timeline.png

    Have to manually delete the meta
    ref.png

    I hope this isn't by design?
    Not even a re-import/re-serialize could remove it. It's as if the AudioTrack was a subasset and just remains forever.

    Which also raises the question. Is this the case for any Timeline track?

    Maybe some utility is needed: "Remove Unused Tracks" which searches the sub assets and deletes ones that aren't directly referenced by the Timeline
     
  2. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    The tracks are sub-assets. There's no real way around it with ScriptableObjects, they need to belong to an asset file on-disk.

    But removing tracks is supposed to remove them from the asset.

    Without knowing what manipulations led to this, it's a bit hard to fix it automatically. We could do a check in OnValidate to check that there are no unreferenced tracks, but that would kill edition performance for anyone that has a large-ish Timeline.

    Similarly with a warning in the Inspector.

    But we could probably add a button in the Timeline Inspector that does a wide sweep of tracks and clips, and compares the list of sub-assets to validate that they are all referenced.
     
    Last edited: Mar 31, 2021
    CDF likes this.
  3. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    A button would be great as a fallback. Ideally though, sub assets get deleted when deleting in the timeline window.

    I'll submit a bug tomorrow
     
  4. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Agreed.

    If it happens again, and you manage to detect it early enough, please report anything you remember about what you were doing when it happened.

    Do you have scripts that copy tracks, or tracks that refer to other tracks?

    It's really interesting that deleting the .meta is what cleared your track.

    Please send us the original (broken) files if you still have them in source control when you report the bug.
     
  5. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    Unfortunately I can't reproduce in an empty project :(. Will need to spend some more time figuring out exactly the setup needed to reproduce.

    I'll report back once I'm able to
     
  6. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Thank you for taking the time to chase this down.