Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Timeline - Available in Unity 2017.1

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

  1. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    There are no delegates, or events (yet). That is planned for a future release. For now you can poll the playable director time and/or state to simulate events.

    You can change the track binding in script using the PlayableDirector SetGenericBinding method. The timeline asset (or any playable asset) contains a list of bindings in it's outputs property. Within each binding is a sourceObject. That's a reference for the timeline track, and can be used as the first parameter to SetGenericBinding. The second parameter is the new scene object (e.g. animator or game object) you want to bind to.
     
  2. Antoine_OSG

    Antoine_OSG

    Joined:
    Sep 2, 2016
    Posts:
    43
    I've just updated to Unity 2017.1.0b5 and I don't understand how to add my Playables in Timeline... I changed my code to implement some PlayableBehaviour and created some PlayableAssets to instantiate them. I can see my Playable in the dropdown list when I right click on a track, but nothing happens when I click it. From what I understand, I need to implement this function :
    Code (CSharp):
    1.     public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
    2.     {
    3.     }
    but I don't see anywhere in the documentation or the forums what I'm supposed to do here...
    Anyone manage to get this to work?
     
    Last edited: May 12, 2017
  3. Antoine_OSG

    Antoine_OSG

    Joined:
    Sep 2, 2016
    Posts:
    43
    My bad. It was a bug in the Timeline window. It was not working properly (the time scale was empty).
    It fixed when I restarted Unity.
     
  4. texdata

    texdata

    Joined:
    May 23, 2013
    Posts:
    15
    thanks, any code samples on how to do it?
     
  5. danvo

    danvo

    Joined:
    Apr 4, 2017
    Posts:
    1
    Thanks! Is there any way to save those Bindings? They don't seem to be part of the Playable asset I am saving.
    Code (CSharp):
    1. private void createPlayable()
    2. {
    3.     TimelineAsset asset = new TimelineAsset();
    4.     AssetDatabase.CreateAsset(asset, "Assets/Animations/" + gameObject.name + ".playable");
    5.     director.playableAsset = asset;
    6.  
    7.     asset.CreateTrack<AnimationTrack>(null, "Animation Track 01");
    8.  
    9.     foreach (PlayableBinding pb in asset.outputs)
    10.     {
    11.         AnimationTrack at = pb.sourceObject as AnimationTrack;
    12.         TimelineClip timeclip = at.CreateClip(animClip);
    13.         director.SetGenericBinding(at, gameObject);
    14.     }
    15. }
     
  6. TomekCoduar

    TomekCoduar

    Joined:
    May 16, 2017
    Posts:
    22
    Hi there! First of all thanks for your amazing job, now to the point: went through a few tutorials already that somehow explained cinemachine and timeline but couldn't find any good way to handle events via script in Timeline. I mean the Playable Track and PlayableAsset/PlayableBehaviour. If there was some tutorial/explanation or demo scene and i missed it I apologize for spaming. I would be grateful for some help here. Any tutorial or explanation would be very helpful :)
    Thanks in advance.
    Thomas.
     
  7. ArthurT

    ArthurT

    Joined:
    Oct 26, 2014
    Posts:
    75
    Is there any chance for us to get the Playables Library examples project updated to use Unity 2017.1? I'm having a hard time trying to convert my older scripts for it to use the PlayableBehaviour, but there are no draft change logs on what the API changes are, in order to find out what to substitute them with.

    Also I noticed in some Unite presentation that there was a special thumbnail preview track actor being shown, would be really great to have that as well (built-in or shipped as an example library).
     
  8. Sarun_Ratta

    Sarun_Ratta

    Joined:
    Mar 26, 2015
    Posts:
    8
    Hi, just want to share some work using Unity timeline. This is a shot animation we create for university project. C&C are welcome.

     
    Rodolfo-Rubens and TomekCoduar like this.
  9. efruchter-within

    efruchter-within

    Joined:
    Dec 14, 2016
    Posts:
    2
    Pardon me if this is somewhere in the docs, but how are we meant to implement
    PlayableAsset.CreatePlayable? I haven't found a way to link behaviors to assets, and it has stopped us from completing the upgrade from 5.6b11. CreateScriptPlayable is gone from PlayableGraph, and there doesn't seem to be a replacement.
     
    Last edited: May 22, 2017
  10. Antoine_OSG

    Antoine_OSG

    Joined:
    Sep 2, 2016
    Posts:
    43
    efruchter-within, I struggled with that one too. I ended up finding a snippet of code on a japanese forum that works.
    Hope it helps. I'd like to get proper examples from Unity though to make sure what I'm doing is right...

    Code (CSharp):
    1. public class NavMeshSetterAsset : PlayableAsset {
    2.  
    3.     public ExposedReference<GameObject> Agent;
    4.     public ExposedReference<Transform> StartTransform;
    5.     public ExposedReference<Transform> Target;
    6.     public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
    7.     {
    8.         var b = new NavMeshSetterBehaviour();
    9.         b.Agent             = Agent.Resolve (graph.GetResolver ());
    10.         b.StartTransform     = StartTransform.Resolve (graph.GetResolver ());
    11.         b.Target             = Target.Resolve (graph.GetResolver ());
    12.         return ScriptPlayable<NavMeshSetterBehaviour>.Create(graph, b);
    13.     }
    14. }
     
    TomekCoduar and Alverik like this.
  11. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    First, I'll say I haven't used Timeline much yet to see all it can do. But anyway, I was wondering... can we expect Timeline to someday be able to animate any field in an object? One of the biggest limitations in the Animation window is that you can only directly manipulate bools in scripts, all other types need to be done through animation events as far as I can tell (and animation events are nowhere as nice to control, they don't even move when you rescale the frames which makes it annoying to relocate them). So, I was wondering, can we expect Timeline to fill this void some day?... I think they are some asset store sequencers which attempt to do this to a certain degree (I think), can we expect Timeline to do it sometime in the future too?

    Or am I just unaware and this is already possible somehow?

    Edit: to be clear I am talking about exposing and animating variables from your own scripts and not native components (which are mostly there already).
     
    Last edited: May 24, 2017
  12. shuao23

    shuao23

    Joined:
    Dec 19, 2013
    Posts:
    33
    Isnt this already possible? Correct me if i'm wrong but I think you can add a property in the animation window and select the script and the variable you want to animate
     
  13. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Nope, I tried this 2 or 3 days ago, since I want to implement the eye animation technique from the legend of zelda, where you use an atlas/spritesheet to animate the eyelids separately from the Iris. So I made a script to control which frame to display based on an exposed CurrentFrame int variable (which works perfectly if I change the var in the inspector during playmode). I wanted to be able to control the frame to be displayed directly in the Animation window, to do custom eyelid animations during cutscenes (so I can start at whatever frame I want, go in reverse, etc. All synced to the underlying cutscene).

    But, when I tried to check the vars under the script (in the Animation window), only bools show up in the list. All my other public variables, which are numbers, don't appear in the list, even though I'm 100% sure they are public fields (and they're not properties, just regular public vars. They show fine in the inspector). Only way to reach them I found was to wrap a var in a public method and pass it to an animation event, but like I mentioned, user experience is terrible that way (events don't even follow the frame under them...).

    Anyway, I'm going to make an EyeController script to control eyelid and iris animation during gameplay (with set states and stuff), but I wanted more control during cutscenes (like shown in one of the pictures, where Midna half closes the eyes, pauses for a moment, then closes them completely, stays that way a moment and opens them again), and I'm still thinking how to do it. Will probably need to use Timeline and a custom Playable I guess...

    Edit: I should've been clear I was talking about exposing and animating variables from your own scripts and not native components (which are mostly there already).

    Edit: I may have gotten my answer here... I'll try making it a float and clamp it.
     
    Last edited: May 24, 2017
  14. TomekCoduar

    TomekCoduar

    Joined:
    May 16, 2017
    Posts:
    22
  15. davidosullivan

    davidosullivan

    Joined:
    Jun 9, 2015
    Posts:
    387
    Hey Guys, I just did a rough update for the Playable Library, thats linked at the top of the thread, for Unity2017.1.b6

    DISCLAIMER: I know literally nothing about Timeline (just started playing with it today) and so have no idea whether what I have done is 'the way to do things' . I just kind of copied the way things were done in the Cinemachine2 beta- all the demos seem to work ok tho ;) Hopefully might save others some time...
     

    Attached Files:

  16. SSoraghan

    SSoraghan

    Joined:
    May 25, 2017
    Posts:
    1
    Is/will there be any support to implement custom inline animation curves with custom tracks?
     
  17. rucafer

    rucafer

    Joined:
    Jan 28, 2017
    Posts:
    1
    How can I play a Tiemline backwards? I haven't found any speed parameter. Is it possible to do it?
    Thanks.
     
  18. jorgeferes

    jorgeferes

    Joined:
    Jul 19, 2016
    Posts:
    1
    This is an Amazing tool! I'm loving it.

    1. I was curious to know if there's any way of exporting the timeline sequence as a video os image sequence.
    2. I was able to download the Cinemachine BaseRig from the unity asset store and work with that or either the "Cinemachine-2-b8-2017-05-09.unitypackage" downloaded from the link you sent. But none of them seems to have the Cinemachine Timeline > Cinemachine Track on the Timeline to add it. =/
    If I import the package on top the Cinemachine BaseRig downloaded from the asset store, a lot of errors shows up on the Console. Since I'm really bad with coding, I have no idea how to solve this part.

    Am I missing something here, is that important for exporting a movie/img sequence from the Timeline?

    Thank you!
     

    Attached Files:

  19. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    The latest Cinemachine is not backwards compatible. Uninstall the old version of CM and do a clean install of the latest. Also make sure you are using the Unity 2017.1 beta version b5 or b6 (can't recall what's the earliest it takes... check the Cinemachine 2.0 thread to verify).
     
  20. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
  21. gekidoslayer

    gekidoslayer

    Unity Technologies

    Joined:
    Sep 27, 2016
    Posts:
    134
    updated the original post with the new playables link as well (also fixed the gdrive permissions so anyone can see the file)
     
    Last edited: Jun 6, 2017
    Alverik likes this.
  22. TomekCoduar

    TomekCoduar

    Joined:
    May 16, 2017
    Posts:
    22
  23. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    I coded a playable behaviour that you can use to play a timeline backwards. It works like a control playable asset, which means that you need to have a timeline that will play another timeline backwards. I attached a package with the necessary playable. I also included a simple scene where you can check how to setup the timelines.

    It even works with particle systems! ;)
     

    Attached Files:

    Alverik likes this.
  24. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    You can use this package (https://github.com/unity3d-jp/FrameCapturer) to capture a video or an image sequence from Unity. The documentation is in Japanese, but a little Google Translate will let you read the documentation :D.
     
    Alverik likes this.
  25. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Hi, I am sure the answer is no, but can this be packaged to work with Unity version 5.4xx ?
    I don't want to upgrade yet as this tends to cause me numerous headaches with regressions/changes Unity brings. Would be cool if a packages could be imported to get the timeline functionality in other versions.
     
  26. GouDZ

    GouDZ

    Joined:
    May 17, 2017
    Posts:
    3
    Hello!

    How can I trigger a timeline from Playmaker?
     
  27. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    Hi @khos Timeline is a 2017.1 feature. There have been a lot of updates internally in Unity 2017.1 which Timeline specifically looks for.

    I hear you on the upgrade concerns - why not duplicate your project and give it a try in 2017.1 ? It might take only a few mins to see how it goes and hopefully there aren't many issues at all. Worth a quick try !
     
    ArthurT likes this.
  28. thierry_unity

    thierry_unity

    Joined:
    Jun 10, 2015
    Posts:
    187
    Hi @GouDZ
    Playmaker would need to create new actions to control Unity's Timeline feature.
    But what you can do in the meantime, is to create a timeline on a GameObject, Convert that GameObject to a prefab and use playmaker CreateObject action to spawn that timeline in your scene. This should launch the timeline right away. Unfortunately you won't be able to do bindings on the fly or even detect when the timeline has ended.
     
  29. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    TomekCoduar and ArthurT like this.
  30. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Thanks Adam, I'll give it a go :)
     
  31. hkcg

    hkcg

    Joined:
    Oct 30, 2016
    Posts:
    3
    I need timeline for 5.6 where should I download it since you removed the experimental preview download link?!!!
     
    Last edited: Jun 11, 2017
  32. davidosullivan

    davidosullivan

    Joined:
    Jun 9, 2015
    Posts:
    387
    I'm a bit confused about what IPropertyCollector is for and how to use it. I have tried setting properties to it in an override for GatherProperties, but as far as I can see it's not doing anything.

    Don't suppose anyone out there has a quick explanation they could give me? :)
     
  33. bingob0y

    bingob0y

    Joined:
    Nov 19, 2016
    Posts:
    4
    I want to ask why these functions OnGraphStart OnBehaviourPlay OnBehaviourPause excute twice?
     
  34. bingob0y

    bingob0y

    Joined:
    Nov 19, 2016
    Posts:
    4
    Is the timeline OpenSource?
     
  35. davidosullivan

    davidosullivan

    Joined:
    Jun 9, 2015
    Posts:
    387
    Since you can create your own track that inherits from TrackAsset, it would be nice if you could create your own inspector for it that inherits from TrackAssetInspector but you cant right now because its internal...
     
  36. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    No, Timeline is not open source.
     
  37. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    TrackAssetInspector doesn't do much other than managing the track name. You can inherit directly from Editor to implement your custom track inspector.
     
  38. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    Normally they should not be executed twice, but could you provide more context?
     
  39. bingob0y

    bingob0y

    Joined:
    Nov 19, 2016
    Posts:
    4
    I want to learn more.But I can't find demo.Is there any demo about timeline?Please give me link.Thank you very much.
     
  40. GouDZ

    GouDZ

    Joined:
    May 17, 2017
    Posts:
    3

    It's true, there is no walkthrough step by step video.
    Would be nice to have:
    From a gameplay, the character reach a trigger and it activate a timeline, in the middle of the timeline it have a waiting for player input, then continue in the timeline and when it's done, it send a message that it's done.

    :rolleyes: Please :oops:
     
    rneron1 likes this.
  41. rneron1

    rneron1

    Joined:
    Jun 16, 2017
    Posts:
    9

    Let me know if you get any tips or link, can't wait to lean more about Timeline and convince my company to integrate it in the prod ;)
     
  42. xtyler

    xtyler

    Joined:
    Dec 8, 2012
    Posts:
    12
    I've written a custom PlayableTrack with a TrackBindingType. I need a reference to that bound component inside my custom PlayableAsset so I can determine duration and other asset values. I haven't been able to figure out how to get a reference exposed to my PlayableAsset.

    See photoshopped example:

     
    Last edited: Jun 23, 2017
  43. xtyler

    xtyler

    Joined:
    Dec 8, 2012
    Posts:
    12
    I'd really like to add Timelines (PlayableAssets) directly to another Timeline's track. So far I've only seen this done by activating/deactivating PlayableDirectors, which is a clunky workaround for large numbers of discrete Timelines. Am I missing something, or will I need to create a custom Playable Behaviour to handle this?
     
  44. xtyler

    xtyler

    Joined:
    Dec 8, 2012
    Posts:
    12
    Is there an [Attribute] or similar that lets me specify a type of asset that can be dragged-dropped onto a Track? I'd like to automatically instantiate a new clip like when dropping animations onto an animation track.
     
  45. xtyler

    xtyler

    Joined:
    Dec 8, 2012
    Posts:
    12
    Also adding a vote for virtual OnDestroy() methods on PlayableAsset and TrackAsset cleanup
     
  46. HugMat

    HugMat

    Joined:
    Mar 30, 2017
    Posts:
    16
    Hi,
    I have an issue with Cinemachine on the new version :

    System.MissingMethodException: Method not found: 'UnityEngine.Texture2D.LoadImage'.

    I checked on the new API and apparently LoadImage does not exist any more on v2017, there is another function, but I can't fix it...
     
  47. davidosullivan

    davidosullivan

    Joined:
    Jun 9, 2015
    Posts:
    387
    Hey hope someone can help here, I am going insane...

    I am trying to change the duration of a clip in a timeline at runtime based on another variable also assigned at runtime.
    I can make it change by getting a ref to the clip asset and then finding the timelineClip that has that asset at runtime and changing its duration.

    All looks fine and works fine. But when I come out of playmode, the clip does not go back to its previous duration!!

    Is this a 'feature' or a 'bug'? I'm sure I'm 'doing it wrong' but I cant for the life of me find how to change a clip duration at run time, by choosing the clip you want to change at edit time and then at runtime changing that clips duration by some other value...

    (I'll post code if the answer is not as simple as 'Duh you need to do it like this dumkopf' or 'not possible'...)
     
    Last edited: Jun 28, 2017
  48. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    You need Cinemachine 2.0. It's on the asset store. That's the good news. The not-so-good news is that it isn't back-compatible with CM1. You'll have to delete the old Cinemachine asset from your project and import the new one.
     
  49. C10110

    C10110

    Joined:
    Jan 19, 2013
    Posts:
    58
    Hello everyone!

    I'm just going to jump in here. I have been using the 2017 since B1, and all the way up to the recent F1. There is one problem I am having that I can not for the life of me figure out.

    I am trying to utilize custom playables. However the functionality of using the inspector to set values and object references seems very broken. Here is a visual example:



    It's not just me trying to code my own functionality. I grabbed the official updated demo package fro B8 and up, that shows lots of playable examples (such as LerpToMove) and even with that unmodified project I have the same issue. (Worth mentioning on both windows and Mac)

    This has been the one thing that has had me super excited for in timeline and I just can't use it :/

    Thank you all for any insight and help! :)
     
  50. Safemilk

    Safemilk

    Joined:
    Dec 14, 2013
    Posts:
    42
    Hey guys, having fun messing around with this, looking forward to what you have planned.

    Right now, for some reason, I'm finding the root motion integration a bit confusing, as well as the track offset stuff being pretty cumbersome.

    [Bug?]
    If I want to integrate an animation clip with root motion, the animation has to start BEFORE the character's root moves from it's origin, my workaround has been to start the animation at it's ref pose, then shave those frames off the front of the clip in the timeline editor, this preserves the length of the clip and initializes the root motion.

    I don't know if this is a timeline issue? Or a base animation API issue, either way, it would make things a lot smoother/more functional if the animation could respect the root motion as absolute from the start, rather than NEEDING a delta. But there are definitely ways to design around this, so I'm not sure if it's even a bug!

    [Suggestion]
    With the track offset functionality, it would be nice to be able to Paste Component Values from a transform into the fields like you can do with components, this would save a ton of time!

    Alternatively, it would be really useful to be able to select a transform in the scene view and have it copy those fields in for the transform values.


    This tool is coming along super well, I'm most interested in doing more dynamic things with it, like feeding in objects to the tracks at runtime, i.e. spawn a player, then assign him to the track that uses the relevant animations, going to mess around with that soon! Thanks for your hard work on the tool!

    Thanks for reading!