Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Timeline - Available in Unity 2017.1

Discussion in 'Timeline' started by mikew_unity, Feb 7, 2017.

  1. Danirey

    Danirey

    Joined:
    Apr 3, 2013
    Posts:
    515
    First i would set the scene objects or whatever you want to animate inside the timeline with default state, be position, or some values in a script, but unchecking the preview button on the top left corner of the timeline window. Once you hafe the default state for the scene objects, you can start edditing the timeline. This is some kind of standard process on every timeline based workflow.
     
  2. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    123
    Here's how you can do it at runtime:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Playables;
    3. using UnityEngine.Timeline;
    4.  
    5. public class TimelineController : MonoBehaviour
    6. {
    7.     public PlayableDirector masterDirector;
    8.     public PlayableDirector slaveDirector;
    9.  
    10.     void Start ()
    11.     {
    12.         if (masterDirector == null || slaveDirector == null)
    13.             return;
    14.    
    15.         //create new timeline asset on the master
    16.         var masterTimelineAsset = ScriptableObject.CreateInstance<TimelineAsset>();
    17.         masterDirector.playableAsset = masterTimelineAsset;
    18.  
    19.         //create control track and clip
    20.         var controlTrack = masterTimelineAsset.CreateTrack<ControlTrack>(null, "ControlTrack");
    21.         var clip = controlTrack.CreateDefaultClip();
    22.            
    23.         //set master clip duration based on the slave's duration
    24.         clip.start = 0;
    25.         clip.duration = slaveDirector.playableAsset.duration;
    26.    
    27.         // this is the tricky part. We will grab the control playable asset from the clip.
    28.         // A ControlPlayableAsset needs an exposed reference set to the object that will be controlled.
    29.         // In order to set the exposed reference to the right value, we need to use the PlayableDirector and the exposedReference's exposedName.
    30.         // This will bind our target game object (the slave director) to the master director's ControlPlayableAsset.
    31.         var controlPlayable = clip.asset as ControlPlayableAsset;
    32.         masterDirector.SetReferenceValue(controlPlayable.sourceGameObject.exposedName, slaveDirector.gameObject);
    33.    
    34.         //Awesome, let's see if this works!
    35.         masterDirector.Play();
    36.     }
    37. }
    38.  
    This should do what you need. The less obvious part is how to set the exposed reference on the ControlPlayableAsset. See this thread.
     
    rakkarage and Carwashh like this.
  3. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    332
    Thanks very much, I'll give it a go at work tomorrow.
     
  4. funyashow

    funyashow

    Joined:
    Nov 19, 2012
    Posts:
    1
    hi

    I try to delete timeline track.

    --------------------------------------------------------------------------------------------
    TimelineAsset _timeline = timeline;
    int count = _timeline.outputTrackCount;
    TrackAsset ta = _timeline.GetOutputTrack (count - 1); // this track is ControlTrack
    _timeline.DeleteTrack (ta);
    --------------------------------------------------------------------------------------------

    I succeed in timeline track elimination.
    The following error goes out.

    --------------------------------------------------------------------------------------------
    MissingReferenceException: The object of type 'ControlTrack' 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.
    --------------------------------------------------------------------------------------------

    Please tell me how it can be settled.
     
    Last edited: Aug 31, 2017
  5. Teh_Lemon

    Teh_Lemon

    Joined:
    May 12, 2015
    Posts:
    17
    Sorry if I've missed something. How do I set the frame without playing the Timeline?

    I have a Timeline that animates Material properties on a trigger hit. The problem is that Material properties don't revert to defaults at the end of the scene play.
    I tried calling playableDirector.time = 0 in my Start() but while that moves the scrubber head in the Timeline editor window, it doesn't actually change any of the objects.
     
  6. Chris_Payne_QS

    Chris_Payne_QS

    Joined:
    Jul 16, 2016
    Posts:
    44
    I've got a disabled GameObject which is turned on briefly using an Animation Track. This all works perfectly while scrubbing the timeline in the editor...but in Play mode, when the timeline completes it turns the GameObject (which was off at the end of the sequence) back on. How do I make it stay off?
     
  7. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    332
    Click on the activation track -> inspector -> change the 'Post-playback state'
     
    Chris_Payne_QS likes this.
  8. Chris_Payne_QS

    Chris_Payne_QS

    Joined:
    Jul 16, 2016
    Posts:
    44
    THANK YOU! :)
     
  9. pocketpair

    pocketpair

    Joined:
    Jul 7, 2015
    Posts:
    6
  10. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    123
    You cannot get the curves at runtime. This is something we get asked a lot; we will try to add a way to get curves in a future Timeline update.

    Happy to hear you adopted Timeline =)
     
  11. rneron1

    rneron1

    Joined:
    Jun 16, 2017
    Posts:
    9
    Hello! Do you plan to make Playmode Timeline Realtime recording? See image example :)

    And in a second question, it can be really useful to have a 3D path with handles to manage animation in Timeline.
    It can be a solid feature for Unity! See example on my second image :) Playmode Timeline Realtime recording.jpg 3D_Path_workspace.jpg
     
    vovo801 and Rodolfo-Rubens like this.
  12. JakubSmaga

    JakubSmaga

    Joined:
    Aug 5, 2015
    Posts:
    414
  13. rneron1

    rneron1

    Joined:
    Jun 16, 2017
    Posts:
    9
    JakubSmaga likes this.
  14. QuestionsBrown

    QuestionsBrown

    Joined:
    Aug 14, 2017
    Posts:
    4
    Does this support spawning objects at specific times using instantiate????
     
  15. QuestionsBrown

    QuestionsBrown

    Joined:
    Aug 14, 2017
    Posts:
    4
    I'm trying to find a way to spawn my AR environment/AR objects after floor detection has been tracking for lets say 5 to ten seconds
     
  16. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,082
    Ah, yes, that would be great, I thought timeline had this from day 1...
     
  17. KenjiJU

    KenjiJU

    Joined:
    Dec 31, 2012
    Posts:
    6
    Does this work with blendshapes?
     
  18. elettrozero

    elettrozero

    Joined:
    Jun 19, 2016
    Posts:
    216
    Timeline play button (while not playing game) is not working.
    No errors in console (I updated Cinemachine to 2.1 RC).
     
  19. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    Hi
    If I want to reference Time line assembly inside a c# project (that will build a dll itself and this dll is not editor one) which version should i reference (there are 3 folders with dll files in it) ?
    there is an editor folder (obviously for those dll projects that has unityEditor reference) but there are two more one called Runtime and one called RuntimeEditor, which one of these two should i reference? (My project won't reference UnityEditor.dll)
    another question is when i would develop a project with UnityEditor in it, again should i choose the one under the editor folder or runtimeEditor one?

    sorry but the lack of information about the difference between these three files are a little troublesome.
     
  20. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    157
    Hello! This seems like a real simple question, and I could have sworn I figured out how to do this when first fiddling with Timeline, but... How do I disable objects via an activation track? The only choice of clip I can add to an Activation track is "Active." But I thought there was a way to add an "Inactive." At the very start of this thread I see this:

    So I'd like to disable the object.

    I do see the track has "post-playback state" options that include inactive, but that's not what I'm looking for.

    Looking to add a key that deactivates the object from within the track.

    Any suggestions? Thanks!
     
  21. SpencerPDX

    SpencerPDX

    Joined:
    Jan 3, 2012
    Posts:
    157
    Aha, looking at it further, it seems that just adding an activation track but not adding an activation key (and deleting the activation key that gets added automatically) make the object go away. No obvious, to me at least, but elegantly simple.
     
  22. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    332
    Click on the clip and you can set active/ inactive/ etc in the inspector
     
  23. cocos2der

    cocos2der

    Joined:
    Jul 1, 2014
    Posts:
    8
  24. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    222
    Where can i download Timeline for my Unity 5.6.3p2 ?
    It was there earlier. What happened?
     
  25. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    437
    It seems that int fields can't be keyed on Timeline. Is there a good reason for this? We have custom components with int fields that need to be animated in Timeline.
     
  26. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,524
    Please make some documentation that clearly specifies the shortcomings of the current timeline system in regards to what has been promised in all of the videos.

    Currently there is no way to tell that this is a LLAPI, a HLAPI is coming, that playable and timeline are related (even the same thing, timeline plays playables).

    But above all, remove the videos that say timeline is effortless and time saving to integrate. Currently a wizard is needed just to get the things to generate properly.

    4 scripts plus an asset just to get something as simple as a basic playable in the scene?

    Please introduce some kind of QA step, and next time if you have missed a release deadline dont just shove it out the door because you said it would be ready then. Timeline is just a more convoluted animation window with support for animating more than 1 object currently , any performance savings are negated by the time it takes to integrate.
     
    alexzlov and Carwashh like this.
  27. JakubSmaga

    JakubSmaga

    Joined:
    Aug 5, 2015
    Posts:
    414
    Suggestion:

    -Add "Destroy" to post-playback state in the Activation Track.

    Also please consider multiple parameters support in the Timeline event system,
    many people hated that UI didn't supported that and still hate that.

    Thank you.

    Jacob
     
    Last edited: Nov 19, 2017
    Louren325 likes this.
  28. manran

    manran

    Joined:
    Jan 30, 2014
    Posts:
    34
    Hi guys i'm trying to import alembic animations files but i cannot find any tutorial on how to play it from the timeline editor for cinematic. Anyone have an idea please? Thanks
     
  29. manran

    manran

    Joined:
    Jan 30, 2014
    Posts:
    34
    Hello guys.
    Anyone know how to play alembic sequence from the timeline? Thanks
     
    Alverik likes this.
  30. prayshouse

    prayshouse

    Joined:
    Sep 11, 2017
    Posts:
    27
    Hello guys,
    After I add a timeline for my particle system, I found my particle system runs faster than before .
    Anyone knows why?
     
    Alverik likes this.
  31. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    731
    Possibly this is due to pre-computation and the ability to add a random seed for particles now.

    To put it in Layman's terms -- in order to scrub back and forth in a timeline and have the particles in a system stay at the exact same positions/scales/etc, having this pre-computed only once with a random seed instead of running in realtime is very likely to save on performance.
     
    Alverik likes this.
  32. prayshouse

    prayshouse

    Joined:
    Sep 11, 2017
    Posts:
    27
    It seems the Start Delay of Particle System does not work after creating a Timeline for the particle system. Is that right?
     
  33. JakubSmaga

    JakubSmaga

    Joined:
    Aug 5, 2015
    Posts:
    414
    Is there any way to collapse all folders with a key/dropdown menu?
     
  34. nickgravelyn

    nickgravelyn

    Joined:
    Jan 22, 2009
    Posts:
    143
    Forgive me if this was already covered in the thread (it's quite long), but is this demo available anywhere? I was hoping to use Timelines to control doors and other "static" elements of my scene for gameplay but wasn't sure how to go about it. Even if there's no demo, if there's are some good docs and quick tips that'd be super helpful.
     
  35. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,524
    Its been almost a year, and I would like some form of decent demo like this too!
     
    Alverik and awesomedata like this.
  36. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Technologies

    Joined:
    May 5, 2014
    Posts:
    1,005
    GameDevCouple_I and rakkarage like this.
  37. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,524
    theANMATOR2b likes this.
  38. Andy-Touch

    Andy-Touch

    A Moon Shaped Bool Unity Technologies

    Joined:
    May 5, 2014
    Posts:
    1,005
    GameDevCouple_I likes this.
  39. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,524
  40. nickgravelyn

    nickgravelyn

    Joined:
    Jan 22, 2009
    Posts:
    143
    Awesome, thanks for the links!
     
  41. Deeeds

    Deeeds

    Joined:
    Mar 15, 2018
    Posts:
    739
    what's the cost of Timeline on mobile for animating transforms (scale, position, rotation, opacity, etc) on 2D objects compared to alternative means? I like the idea, and the curves, but worried about weight and inefficiencies. Not a coder, so wouldn't know where to begin in terms of testing performance.
     
  42. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    782
    Having a playable director play a timeline will instantiate the whole graph as far as I know.
    Which is will contribute a LOT to GC pressure.
    Since you're not a coder I'll put it in other words:
    Every time some sort of playable actually gets played it will create some internal objects, which will likely not get reused and thus become something named "garbage", which a system called the garbage collector later collects (not immediately, but when a lot of objects have been created, it will eventually trigger a collection, which is the thing you want to avoid because it literally pauses your game for a few milliseconds, in some cases long enough or often enough to be really noticeable).

    The part where a playable/timeline is actually playing and doing its thing, is probably be more or less on the same level as the existing animation editor, but I'm not sure.
    This part you can easily test yourself though. Just make a simple animation that animates multiple properties of something and check how the two compare in terms of FPS in a built game (not in editor)
     
    twobob likes this.
  43. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    810
    hi it's possible to custom audioplayableasset on timeline please
     
  44. SKoptev

    SKoptev

    Joined:
    Jan 15, 2019
    Posts:
    23
    Necroposting, ofc, by I faced the same problem. The reason is TimelineEditor window - when currently viewed asset changed from script, you should update it.

    Code (CSharp):
    1. if (TimelineEditor.inspectedAsset == timeline)
    2. {
    3.     TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved);
    4. }
     
    kilik128 likes this.
  45. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    181
    Hey, can I leave a feedback about Timeline on this thread?

    A GameObject can't be made as prefab if it has a Playable Director component and its timeline panel is opened.
    I have to close the Timeline panel to make it as prefab. It's not that tricky to find, but I'm writing it in case if this isn't the intended behaviour...
     
  46. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    810
    thank's
     
  47. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    222
    Hi guys!
    Is there any possible way to use timeline with 5.6
    What is the most recent version that can be used in 5.6.7
    Perhaps there`s a way to do this?
    Thanks!
     
  48. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    863
    Unfortunately no, Timeline only works from 2017.1 onward.
     
  49. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    863
    Yes, this is a known issue. The preview mode is currently not compatible with prefabs. You should be able to disable the preview on timeline and make the prefab.
     
    NGC6543 likes this.
  50. musolo

    musolo

    Joined:
    Sep 12, 2014
    Posts:
    222
    What about beta hat was in 5.6.0b6?
    I downloaded it and timeline is not there anymore:(
    Could you please help me get the Timeline Experimental Preview Installer?
    Maybe there are links to it that i missed?
    Guys if anybody stil has Timeline Experimental Preview Release 1 please share it with me
    My email is: musolo78@gmail.com
    Thanks!
     
    Last edited: Jun 11, 2019 at 12:42 AM