Search Unity

Create a copy of a TimelineAsset to modify at runtime

Discussion in 'Timeline' started by ryanas, Jul 18, 2019.

  1. ryanas

    ryanas

    Joined:
    Oct 2, 2013
    Posts:
    14
    Is there a way to create a copy of a TimelineAsset so I can modify the contents without having a reference to the original asset?

    I am working on a project where we need to modify the bindings of a track and the contents of a clip but it generates changes for the reference TimelineAsset and will flag up a change in our version control.

    This isn't really desirable because the content changes continuously which means team members will have changes in these timeline assets by just running the game.
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Unfortunately no, or at least, not at runtime. Object.Instantiate won't work with Timeline assets because it will reference the tracks from the original instead of copying them.

    You can use the AssetDatabase to make a copy, but that only works in the Editor, not in a player.
     
  3. TheHeftyCoder

    TheHeftyCoder

    Joined:
    Oct 29, 2016
    Posts:
    91
    Why is the behavior like this? Seriously.. I spend hours of my life creating a tool that can bind new dependencies to a cloned timeline (i.e change an audio clips clip), only to find out it changes the dependencies of the original asset. Great!