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

Playables API changes from 5.6 to 2017.1

Discussion in 'Timeline' started by julienb, Jun 9, 2017.

  1. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    In version 2017.1 of Unity, we made a couple of changes to the Playables API in order to make it cleaner and easier to work with. However, it meant that custom playables, tracks and clips needed to be updated when transitioning from 5.6 to 2017.1.

    I wrote a document to help with that transition. Most of the use cases should be covered. If anyone has any hurdles, don't hesitate to ask for help :)

    https://drive.google.com/open?id=0BxXa-EKSOUL9ZlNMTGxVN1VDVzA
     

    Attached Files:

    Last edited by a moderator: Jun 9, 2017
  2. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    374
    Hey, first of all, thank you so much to you and the team who put this all together, Timeline looks amazing so far!! I'm wondering about a few things though (I hope it's not too much haha)

    What's the role of this method (below) in the TrackAsset class? If there's documentation on this, that would help too :)
    Code (CSharp):
    1. public Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)

    In general, I'm kinda confused on what the PlayableGraph is for if there's a Timeline, and what the inputs and outputs mean. I'm familiar with node-based data structures, but I'm not too sure what the PlayableGraph does.


    What's the difference between the types Playable and ScriptPlayable<T0>?


    Any help is very much appreciated!
     
    Last edited: Jul 8, 2017
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    The change is very, very nice. I updated the PlayableGraphVisualizer to work in 2017, and I tried to also make it work for 5.6. I gave up. The 2017 version was no problem to make work. So great work on that!



    @ModLunar, I'm using it where you'd normally use the AnimatorController. You're pretty much free to create custom ways to author animation trees, which is great (the standard way to use the Animator is... not good".
     
    ModLunar likes this.
  4. ahmidou

    ahmidou

    Joined:
    Sep 17, 2012
    Posts:
    87
    Baste likes this.
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    Man, they moved to github! Should've checked.

    Well, porting the code taught me a lot about the API, so the effort wasn't wasted.
     
  6. julienb

    julienb

    Unity Technologies

    Joined:
    Sep 9, 2016
    Posts:
    177
    CreateTrackMixer creates a playable that will act as a mixer for the track. The purpose of a mixer is to be able to blend multiple playables together (see https://docs.unity3d.com/2017.1/Documentation/Manual/Playables-Examples.html, section Creating an animation blend tree). In the case of timeline, a track mixer can also use a track's bound object.

    Check out the SubtitleMixer class from seant_unity's Subtitle example. It will show you how to create and use a mixer.

    Also, you can use the PlayableGraphVisualizer to see how the timeline graph looks.

    In a PlayableGraph, an Output defines which system will be used to play the graph connected to it. For example, an Animation Output will use an Animator to play the animation.

    With a Playable, an input is what is connected to the current playable, and an output is what the current playable is connected to.

    See this page https://docs.unity3d.com/2017.1/Documentation/Manual/Playables-Graph.html for more information.

    Playable is just a handle, it can’t be customized. That's where ScriptPlayable is useful; it lets instantiate your own types of playables:

    Code (CSharp):
    1. Playable customPlayable = ScriptPlayable<SubtitleMixer>.Create(graph, inputCount);
     
    Last edited: Jul 13, 2017
    ModLunar likes this.
  7. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    I seem to remember having played a clip on a gameobject without an Animator in one iteration of Playables. Did that possibility get removed, is it still there, or am I just remembering something that wasn't there?

    We've found that Animators have a very, very large cpu overhead, even when they're not doing anything (ie. "playing" a state with no clip). They're also theoretically not required, since we're not dealing with AnimatorControllers or parameters when using a playable graph.
     
  8. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    374
    @Baste Oh okay cool, thanks! It looks really flexible :)

    @julienb Wow, thank you for your detailed post! It really helps point me in the right directions, I'll definitely be reading more up on it all :D
     
    julienb likes this.
  9. Carwashh

    Carwashh

    Joined:
    Jul 28, 2012
    Posts:
    760
    In one of the talks at Unite Europe the speaker said the API would be changing for Timelines to make it simpler (not needing x5 classes?) ... is there any idea of when this update will be released?
     
  10. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    It's still to be determined, we are meeting with them in a couple of weeks to iron out details on it.
     
  11. CraigGraff

    CraigGraff

    Joined:
    May 7, 2013
    Posts:
    44
    I realize this post is quite old, but I thought it might be worth answering anyhow.

    You can play timelines just fine without an Animator, but you will probably want to remove the Animation Track that is automatically assigned when you create a timeline by selecting a GameObject and clicking "Create" on the Timeline editor. (As well as removing the Animator component created on the GameObject, of course).
     
  12. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    Are you suggesting that I use the Timeline as a generic animation tool?

    That seems kinda hacky. I might give it a go, though. Thanks.
     
  13. marcV2g

    marcV2g

    Joined:
    Jan 11, 2016
    Posts:
    115
    Is the playable graph ever going to be merged in the main unity code base? The graph visualiser will not compile on 2017.3 beta.