Search Unity

Custom Track or editing existing Timeline Events Asset code ?? - NOT Signals !

Discussion in 'Timeline' started by artofmining, Oct 14, 2019.

  1. artofmining


    May 1, 2016
    Hi everyone,

    I am using Timeline (2019) within a Unity system that I have built to aid me in filmmaking. Principally I have small cartoon show I'm working on as an Indie called Pit Mouse. The filmmaking comes by way of a CutScene approach. I record the output direct to Video using Unity recorder. these clips makes up the film. (post edit).

    Within timeline I use a single Audio Vocal Track to which any or all characters in scene can lip sync (blendshapes) by way of a boolean on/off. Each character has an "Actor Controller" script attached. This script contains a number of Public void Functions that can be called to trigger something. i.e Make head look at another object or activate lipsync or blink, nod yes/no etc.

    Could I use Unity Signals? YES of course BUT they are a pain in the A! Having to create emitters and recievers for EVERY event I wish to trigger to control the actors (characters). In a scene with mutiple actors this soon gets VERY messy.

    What about Timeline Event Asset? -

    This is a brilliant FREE script but it falls short for my need. Namely the methods available which are Bools, Ints, Floats and Strings. Ideally I want GameObject in addtion.

    Imagine a Timeline with a single vocal audio track that contains conversation between 2 or more actors.
    My Actor Controller script on each character allows me to set a particular character to responds to lipsync. It also lets me trigger the character to LOOKAT another object or another chracter as you would expect to see in a film or show. basically it adds life to the actors.
    Using Timeline events I can call a specific function on a specific Actor GameObject and pass it a method (bool, int, float or string). I currently use a STRING value which correlates the GameObject's name. (my actor code then does a GameObject.Find to get it.

    IDEALLY I want to be able to choose a GameObject as a method and pass that to the function. It avoids potential mistyping a string of the name. And more importantly it would be much faster to do production by simply dragging a GO. (similar to how you drag one in an event)

    The question leads to how to do it. I'm not a C# guru I know enough but its not my trade.

    I looked into the possibility of a "CUSTOM TRACK" but that feels above me. (boilerplate approach)
    So therefore Timeline Events Asset -
    I wondered if any of you code masters know if its possible to add an additional method to this script?

    One that would allow me to select a GameObject as a method.

    If not how deep of a challenge would it be to create a Custom Track to fullfill the same role?

    Appreciate any insight or guidance, I know it's a big ask but happy to share back such code with the community.

    Many thanks
  2. julienb


    Unity Technologies

    Sep 9, 2016
    A while ago, I wrote a message marker. This is a marker which works like an Animation Event; you can assign a method to it and this method will be called when the timeline hits the marker.
    A message marker supports methods that take a GameObject as an argument, so it looks like it does what you want. upload_2019-10-15_11-9-34.png
    sergiusz308 likes this.
  3. artofmining


    May 1, 2016
    UPDATE: Works just fine so really appreciate you sharing !!!
    Many thanks Julien I'll take a look at it later looks like it might work I'll let you know.
    Last edited: Oct 15, 2019
    julienb likes this.