Search Unity

Blend multiple directors affecting the same object binding

Discussion in 'Timeline' started by LazloBonin, May 12, 2019.

  1. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    812
    Hi! So apologies in advance if I get some of the terminology wrong, it's still a bit confusing to me.

    I have a custom track and it works well so far.
    For simplicity, let's say the track changes the color of a light.
    What I'd like to do is have multiple timelines playing and affecting a single light simultaneously.

    So for example, in timeline/director A, the track would set the light color to blue; and in B, it would set it to red. When both of these things are running at the same time, I'd like my MixerBehaviour to be able to pick up both the red and blue inputs in ProcessFrame and blend them to magenta.

    Is there any way to do something like that?
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    No, the timelines are completely unaware of each other. The pattern to use here is have a monobehaviour that accepts 'the request to change the light color' from the timeline scripts. i.e. Instead of writing directly to the light, call a method on the monobehaviour. Then the monobehaviour can blend it altogether in LateUpdate().

    This is more or less the pattern of animation tracks and cinemachine tracks. Timeline gathers the data, and then the player loop processes all of it to produce a final result at a later time.
     
    LazloBonin likes this.
  3. LazloBonin

    LazloBonin

    Joined:
    Mar 6, 2015
    Posts:
    812
    Thanks for the clarification!