API to refresh sequence selection?

I tried creating my own script to add assets to a sequence (my version of Sequence Assembly). You put prefab variants into a hard coded folder tree and a window will list the things in that directory with a button each. Clicking the button adds the prefab to the scene directly under the sequence, and adds the prefab to an Animation Track to the timeline.

But I am having problems.

  • The timeline panel does not update to show the new Animation Track - I have to click around for a while until it updates (do I need to do a “save” or something?)
  • Changing selection of the sequence is no longer updating reliably - so flipping between sequence selections in Sequence/Structure does not always update the currently selected sequence (so it stays deselected) - not sure if my code or something else

If anyone had time to look at the code in the GIST above and point out errors it would be greatly appreciated. It mainly works, but other things not updating to show results is a pain.

Note, if I exit Unity and start it up again, and don’t do anything with my code the selection problem remains. Are you allowed to have non-SequenceAsset instances under a Sequence in the scene? E.g. clicking on “Position1” is leaving “Position2” selected in the scene (not selecting Position1). I cannot see any related messages in Console. (I was grouping CM cameras under the Sequence in the scene for example). I mention this because adding a new position (sequence) then adding only character prefab variants directly under it stopped the Location sequence activating the “Downtown Set Scene” (I activate that scene at the Location sequence level rather than repeating per “position” (shot) subsequence). Removing my child object and adding it using Sequence Assembly (with the Sequence Asset around it) made the parent Location scene enabling code work again, but I still cannot flip to Position1 or 3 sequences any more.

Okay, so some of the second problem was adding and extending sub-sequences does not lengthen the parent. My master sequence had one length, the Location subsequence had a different length, then the sub-sub-sequences (!) as they grew and more were added, grew beyond the length of two layers above. Because the 3 levels had different lengths it was behaving weird (because it activated things based on the the location of the playhead and the length I had dragged out the parent sequence).

But things are still not activating and deactivating reliably. Sometimes it does not activate and deactivate the right sequences as the playhead is moved around (e.g. all three Position sequences would activate and the Location (the parent) would deactivate (exactly one Position should activate at a time, and the Location should always be active). I move the head forward a few frames and it would go right. I move a few more frames again and it would go crazy again. Then I try to repeat and it works perfectly. I will see if I can spot a pattern.

One small thing that feels like a bug. If I save the scene it loses the correct current selection. I have to move the playhead (e.g. forward one frame) for it to get the correct things selected again (e.g. the Scene Activation is lost, and all 3 positions activate at the same time). (For me this shows all the characters from the sequences at the same time!)

Move the playhead (I click the “forward frame” button in the Timeline) and it gets it all worked out again.


So easy workaround, but hopefully not hard to fix. (I save a lot! Lol!)

Hi @akent99 ,

Thanks for your patience, it’s been a bit slow lately due to vacation.

Actually yes, you need to call TimelineEditor.Refresh() to update the Timeline window after you finished adding a prefab instance.

Was this linked to the issue you discovered afterwards with the parent clip length not matching the subsequences length?

Yes, you can have non-SequenceAsset under a Sequence GameObject. Also, you can lock your TimelineWindow to keep the current context while manipulating non-SequenceAssets GameObjects in your hierarchy. This can probably help you since Timeline will stop evaluating your MasterTimeline if it focuses on a GameObject with no PlayableDirector attached to it, meaning your Sequences and Scenes will be back to their original state. We recommend locking your Timeline Window to avoid such cases.

Parent’s clip length doesn’t resize automatically because we don’t necessarily know how it should affect the adjacent clips.
We have exposed a new action from the Editorial track contextual menu: `Match Editorial Content (Ripple)". It’ll resize the length of all clips to match the combine length of all their respective subsequences for you.

It seems the TimelineWindow went out of preview mode or the PlayableGraph stopped playing. That’s why you end up with Downtown Set Scene disabled or all Sequences active in the Hierarchy. Which version of Unity, Sequences and Timeline are you using?

Ah! Thank you! I will give that a go. (Having my own little script to add characters directly in and creating tracks etc (basically more automation) is definitely improving my productivity. It does mean however I no longer use Sequence Assembly or Asset Collections - because I want to add animation tracks, not references to nested sequence tracks.)

It could be. Things are behaving better now after I got a spreadsheet, wrote down a preallocated a length per shot, then allocated twice the length in the sequence timeline (buffer space between things). I use a separate recorder clip per segment. That gives me space to lengthen and shorten things without ripple. I just glue the video clips together later (carefully numbered so the directory comes out in order). It basically avoids the ripple edit/expand problem, but I will give the new tool a try for sure!

Currently using 2021.2.0b3, sequences-1.0.0-pre.6, and timeline 1.6.0-pre.5.

But my next exciting task is to learn how to break my one big project (with everything shared) into multiple smaller projects (planning to do one per location), while sharing characters and props between projects. I have pushed Unity over an edge on my little laptop and Unity is now VERY sluggish. I use git for backups already, but I think I am going to add many packages to multiple projects, I don’t really want to repeat them all in each git project. Also do I really need to make backups of asset store downloads? More reading!

Exact steps to repeat the “Save” problem I reported before. Here are (some very tall sorry) screenshots of before and after hitting CTRL-S to save the scene. Before:

Notice the scene and timeline have an “*”, and the scene view just on the right shows some of the location set.

Then I type CTRL-S (Save) and here is the new screenshot.

The “*” has gone, but the Set Scene has disappeared and all the sequences are now active (you can see characters from another shot sequence). The “Preview” is still white.

I click “Go to next frame” to move the playhead forward by one frame and it all comes back to normal.

(TimelineEditor.Refresh() did the trick by the way, perfect!)

Thanks a bunch for your detailed posts, that’s very appreciated and we like following you in your journey :smile:

I managed to reproduce the issue with the Save action. I filed a ticket on our end to look at it as it’s not the intended behaviour (Timeline also keeps saying the data is in preview while it’s not in the Hierarchy).

Another workaround at the moment when this happens:

  • Toggle off and on the “preview” button at the top left of Timeline. It’ll force Timeline to evaluate the data at the playhead current position. You won’t need to move the cursor of a frame.

7375580--899495--upload_2021-7-30_14-6-59.png

Interesting approach! Is ripple the issue here? What your technique solves for you in this area that Sequences/Timeline don’t?

I’m going to take this opportunity to inform you that Sequences 1.0.0 and Timeline 1.6.1 have been released! You should see them in the Package Manager. We’ve done a couple of improvements/optimizations in Sequences since 1.0.0-pre.6. That might help you get a more responsive experience.

Yes, I was talking about ripple. Basically planning out shots more in advance and leaving buffer space in sequences reduces the number of times I need ripple insertions (which were previously a bit painful to do). I started with everything lining up perfectly, but it was a pain to extend a shot by a few frames due to the ripple up the sequence hierarchy. (Note that I want short video clips for my use case, so having gaps is not an issue.)

Also I initially planned to do more camera transitions in a single recording - e.g. have characters walking along a street talking with camera moving between them. But this turned out a mistake for most shots - I ended up repositioning the characters almost every shot. For example, I tweaked lighting per shot so the shadows looked good - it ended up easier starting a new sequence per clip (rather than using cinemachine to flip the camera around in a single video clip). I am creating video files, not cut scenes in a game, so I have a lot more freedom in such things. “If the result looks good, it is good.” This is why the “add character to scene with an animation timeline” quickly became so important.

Each episode I am trying to create the “emotional” timeline, then script, then lighting and color, which shots to use when, etc. (I don’t know what the right name is for “emotional” timeline - but there is normally has a start, a build of tension/excitement/pity, climax, and release. Each shot should support that flow. The current demo so far is all start - no build/climax/release yet.) So I need to plan things out anyway. I expect once I get more practice this will become easier and more natural - still learning as I go.

Cool! Will give it a go. I also am upgrading from a Microsoft Surface Pro 5 with dying battery to a Corsair a200 (12 cores, 32GB ram, RTX 3080) - I am hoping that will improve performance a bit too! . (I am going to defer splitting the project until the new machine arrives in case it is fast enough without all the messing around managing multiple projects.)

Thanks for all the answers! It really does help. Once I have a few episodes completed and feel happier with the tools and overall workflow I plan to summarize in some YouTube videos in case helpful to others.

1 Like

I assume the “Cinematic Studio” “Feature” in Package Manager will be updated at some time soon too? Just noticed it still uses 1.0.0-pre.6. (Looks like it needs to be kept in sync with “Gameplay and Storytelling” and “3D Characters and Animation” as well as they all use Cinemachine 2.8.0-pre.1) - or is it better to use packages directly and not Features?

Yes, it’s in progress, there is an additional step for the feature set to be updated in 21.2.

Generally speaking I would use the feature set because it shows what packages are interesting and compatible.
And, you can still “override” the feature set and install the 1.0.0 if you don’t want to wait for the update

Anyways, I’m taking this chance to thanks you for all of your feedback. It is truly appreciated :slight_smile: