Playables API changes from 5.6 to 2017.1

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 :slight_smile:

3102278–234235–PlayableAPIUpdate.pdf (136 KB)

7 Likes

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 :slight_smile: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?

Any help is very much appreciated!

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".

1 Like

I haven’t tested it with 2017.1 but there already an “official” updated version of the graph visualizer:

1 Like

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.

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:

Playable customPlayable = ScriptPlayable<SubtitleMixer>.Create(graph, inputCount);
1 Like

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.

@Baste Oh okay cool, thanks! It looks really flexible :slight_smile:

@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 :smile:

1 Like

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?

It’s still to be determined, we are meeting with them in a couple of weeks to iron out details on it.

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).

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.

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.