Search Unity

Detecting value changes in a timeline behaviour & Auto clip renaming

Discussion in 'Timeline' started by arvzg, Sep 19, 2018.

  1. arvzg

    arvzg

    Joined:
    Jun 28, 2009
    Posts:
    619
    I've got an enum variable in a playable behaviour script:

    Code (CSharp):
    1. [Serializable]
    2. public class CharacterDriverBehaviour : PlayableBehaviour
    3. {
    4.    public CharacterAction Action;
    5. }
    Where CharacterAction is an Enum. Using the playables wizard, I generated a property drawer for all of this, and the enum is drawn with a dropdown in the inspector.

    I want to rename my clip to be equal to the value of the enum, so I need to know how to:

    1. Detect when the value has changed
    2. Set the clip name

    I believe for #2, the display name has to be set through the track using the displayName field, however I don't see this displayName in the manual for TimelineClip although visual studio can find it.