Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

AudioTrack destroyed in runtime

Discussion in 'Timeline' started by ipylypenko, Mar 4, 2020.

  1. ipylypenko

    ipylypenko

    Joined:
    Feb 17, 2020
    Posts:
    2
    Hey guys!

    I'm creating timelines from script in ScriptableObject, and I save it using
    AssetDatabase.CreateAsset()

    But then when I run the animation after manually binding the new timeline to the game object, the tracks are destroyed.

    "MissingReferenceException: The object of type 'AudioTrack' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object."

    Here's a video that will hopefully clarify the bug.


    Your input is much appreciated!
    Thank you, Irene
     
  2. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    146
    Call `AssetDatabase.CreateAsset` on the TimelineAsset before using `CreateTrack`. The TimelineAsset needs to be in the Asset Database before tracks are created.
     
  3. ipylypenko

    ipylypenko

    Joined:
    Feb 17, 2020
    Posts:
    2
    This works! Thanks so much julienb!
     
    julienb likes this.
unityunity