Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Question Custom Nested timeline, without GameObjects?

Discussion in 'Timeline' started by Sangemdoko, Apr 3, 2023.

  1. Sangemdoko

    Sangemdoko

    Joined:
    Dec 15, 2013
    Posts:
    215
    Hi,

    I'm trying to build a system with many timelines. I'm making custom tracks such that my tracks/clips can get references of things isnide my scene through my custom systems (without relying in unitys "exposed properties") This allows me to work on my timelines in any scene (or even multiple scene).

    Now I want to be able to nest timelines. The "default" approach is to use a control track. This takes the Playablebehaviour on a GameObject in the scene to deduce the timeline to play.

    But as described before I want to avoid any references to things inside the scene through exposed properties.
    Thankfully ControlTracks allow prefabs. so I can make a prefab with a PlayableBehaviour and use that.

    Two issues to that approach though.
    1) I have to create a prefab for every single TimelineAsset I plan to nest.. which seems completly unecessary
    2) I can't "open" the nested timeline by double clicking on it. Check how the GameObject refence in the top clip has an arrow and the one below which references the prefab does not:
    upload_2023-4-3_17-43-4.png
    The one with the arrow allows me to double click on it to see the nested timeline.


    So my plan is to create a custom track/clip that takes in a TimelineAsset as input and it could dynamically create a gameobject with a playableBehaviour with the TimelineAsset assigned to it.
    The part I'm not sure about is how to allow to "open" the nested timeline by double clicking the way it works for gameobject references?

    Any advice would be welcomed?
     
  2. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    Have you looked at the Sequences package in Unity? I use the parts from it I like (not all of it). For example, it allows a "master sequence" to have references to "child sequences" (currently 3 deep, with a future release supporting arbitrary depth I believe). The parent sequences have clips referring to child sequences, so you can put the child sequences in a row.

    I am not sure it will meet your needs of not referring back to the scene hierarchy. I ended up navigating the hierarchy of timelines mainly using the scene hierarchy myself, then finding the timelines associated for each sub-sequence that way. But if you have not looked at it, it might be useful.
     
    Yuchen_Chang likes this.
  3. Sangemdoko

    Sangemdoko

    Joined:
    Dec 15, 2013
    Posts:
    215
    Interesting I was not aware of this package. I wonder if it's a good fit for my project though considering the branching aspect of gameplay cinematics.
    I'll definelty look into in more detail