Home > Software design >  Comunication with Timeline with button in Unity
Comunication with Timeline with button in Unity

Time:01-04

I was trying to find some way how to branch Timeline and play this branch after you select one of two options with button. But I did not find it.

Example: You have two different paths (right path and left path). You click on right button for select right path it will trigger part of timeline or new timeline. Or you can click on left button for select left path...

Can this be done by signal emitters? And I need for this more then 1 timeline or I can branch timeline and select one of the branches? Have somebody experience with this if statement in Timeline?

I need just hint how to do this or it is possible at all. :D Thanks for help.

CodePudding user response:

A script-free method would be to play the primary timeline and have an activation track that activates a parent GameObject that has two or more GameObjects as children, which in turn have their own PlayableDirector-Components with the "Play on Awake" option checked. These child GameObjects are initially disabled and depending on the branch or button click, you activate the selected GameObject and you have a branch to other timelines without the need for a script.

With scripting there is an option to mute tracks, for which the playable graph has to be recreated, and as far as I know you also have to search the tracks by name, so you have to rename the tracks and do a somewhat vulnerable string comparison. But that works as well and it can be done with one timeline.

CodePudding user response:

I think it's possible. I don't know exactly how you want it to run but let's say you branch and freeze everything in place and instantiate/copy everything to run in place of the original copies. Then when a condition is met like a button or a timer you can destroy everything that was copied and unfreeze the originals for a rewind kind of effect. There's probably a bunch of different ways you can do it but that's what I can think of off the top of my head.

  •  Tags:  
  • Related