Search Unity

  1. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. If you're a macOS 10.13 High Sierra user take be sure to read this before updating Unity.
    Dismiss Notice
  5. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  7. Unity 2017.3 beta is now available for download.
    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:
    485
    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:
    74
    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.
     
    Carwashh likes this.
  3. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    250
    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:
    15
    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:
    35
    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:
    250
    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:
    35
    THANK YOU! :)
     
  9. pocketpair

    pocketpair

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

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    74
    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
     
    Rodolfo-Rubens likes this.
  12. JacobSmaga

    JacobSmaga

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

    rneron1

    Joined:
    Jun 16, 2017
    Posts:
    9
    JacobSmaga 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,033
    Ah, yes, that would be great, I thought timeline had this from day 1...
     
  17. KenjiJU

    KenjiJU

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

    elettrozero

    Joined:
    Jun 19, 2016
    Posts:
    123
    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:
    121
    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:
    115
    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:
    115
    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:
    250
    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:
    187
    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:
    297
    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. Daemonhahn

    Daemonhahn

    Joined:
    Oct 5, 2013
    Posts:
    264
    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.
     
    Carwashh likes this.
  27. JacobSmaga

    JacobSmaga

    Joined:
    Aug 5, 2015
    Posts:
    207
    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
  28. manran

    manran

    Joined:
    Jan 30, 2014
    Posts:
    9
    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:
    9
    Hello guys.
    Anyone know how to play alembic sequence from the timeline? Thanks