Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question One Director, many Timelines? Newbie Timeline questions...

Discussion in 'Timeline' started by Reverend-Speed, Oct 12, 2022.

  1. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    My hope had been that I could setup a Playable Director as a singleton and just swap in and out Timelines as I wanted scripted sequences to occur - essentially, one Director, many Timelines (one per scripted sequence)

    However, I'm looking at the Bindings section now, and I'm starting to think this isn't possible. Can anybody clarify if I could use a single Playable Director or if I'm barking up the wrong tree?

    For example, say I have a scene, SceneA. This scene has a character, a door and a mug of tea.

    Would it be possible to have TimelineAsset01 play on the Singleton Director and move the character through the door, then replace TimelineAsset01 on the Director with TimelineAsset02 and have the character walk over and drink the tea? (All of these as animations and/or navmesh movements orchestrated by relevant Timelines)

    Furthermore, could we then load SceneB and use the same Director (via DontDestroyOnLoad) to have a chest open as a dog walks in circles using TimelineAsset03?

    I've started playing around with this: https://assetstore.unity.com/packages/essentials/default-playables-95266#description - but any advice or suggestions warmly appreciated!
     
  2. arkantose

    arkantose

    Joined:
    Dec 22, 2021
    Posts:
    8
    From what I understand about cinemachine; you can only have one timeline per PlayableDirector. You can have the timelines activate each other though using either a control track or a signal receiver. Hope that helps.
     
  3. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    Have you looked an Animation state machines? Just wondering if that is a more well trodden path to follow https://docs.unity3d.com/Manual/AnimationStateMachines.html

    You mention "bindings" thinking its not possible. It might be possible, but more complicated. The idea is a Timeline asset on disk is not bound to game objects in a Scene. So when you want to play a timeline, it has to know "which game object is the runtime character I should animate?" So you have the runtime settings (game objects) and the timeline asset that have to work together. If you flip the timeline, you also have to update the bindings needed by the new timeline. I just wonder if you are making life harder for yourself than needed. E.g. why not have multiple playable directors (with bindings set up) and flip the playable director game object to use instead.

    But that is where the animation state machines come in. This is kind of what they are for, so why not use them instead? They allow chaining of animation clips based on state changes.

    PS: I don't use any of this personally - I use Sequences for animated movie creation.. Sequences has the ability to have a Sequence timeline contain reference to other timelines, so you can play one after the other, but in a fixed order. This approach is an alternative to state machines - they don't play well together at the moment.
     
  4. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    That's nice and clear, @arkantose , thank you!

    @akent99 , well, the use case for me is that I'm working with two animators on what's basically a point-and-click adventure, where there's a lot of scripted events and conversations after item interactions, etc.

    My hope was that I could encourage the animators to use Timelines as a visual scripting/sequencing system for cutscenes, etc, so they wouldn't have to do much coding. Given that items on one scene could be used to start a cutscene on a second scene (eg. 'use mug (from Scene1) on water (in Scene2) => play 'drinking water scene''), I thought that a singleton Director would be an effective way for the animators to setup cross-scene events.

    I understand the Director contains the binding to the world objects now, not the Signals / Timeline.

    Time for a rethink! ¯\_(ツ)_/¯
     
  5. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    Sounds cool. It might not be relevant, but I am trying to create a animated episode. Its effectively a mega cutscene sequence - okay, so maybe better described at a mega cutscene with no game! :)

    Using Unity Sequences (which are fundamentally Timelines organized into a hierarchy), what I have found easiest is just create a new set of objects per sequence - I don't flow the same game object throughout the whole scene (although you can). I often tweak the object settings, so I just create a new mug. It means each camera shot sequence is independent. So I just start again each time. It allows me to cheat with good camera angles (I adjust positions slightly per camera move so the shot looks good). They added a custom track type that allows you to chain child sequences together so they play one after another. *Might* be useful to allow different animators create separate timelines, then hook it together later.