docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TrackEditor

    Use this class to customize track types in the TimelineEditor.

    Inheritance
    object
    TrackEditor
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEditor.Timeline
    Assembly: Unity.Timeline.Editor.dll
    Syntax
    public class TrackEditor

    Fields

    DefaultTrackHeight

    The default height of a track.

    Declaration
    public static readonly float DefaultTrackHeight
    Field Value
    Type Description
    float

    MaximumTrackHeight

    The maximum height of a track.

    Declaration
    public static readonly float MaximumTrackHeight
    Field Value
    Type Description
    float

    MinimumTrackHeight

    The minimum unscaled height of a track.

    Declaration
    public static readonly float MinimumTrackHeight
    Field Value
    Type Description
    float

    Methods

    GetBindingFrom(Object, TrackAsset)

    Override this method to determine which object to bind to track. A binding object should be determined from candidate.

    By default, the TrackBindingType attribute from track will be used to determine the binding.

    Declaration
    public virtual Object GetBindingFrom(Object candidate, TrackAsset track)
    Parameters
    Type Name Description
    Object candidate

    The source object from which a track binding should be determined.

    TrackAsset track

    The track to bind an object to.

    Returns
    Type Description
    Object

    The object to bind to track.

    See Also
    TrackBindingTypeAttribute
    TrackAsset

    GetBindingType(TrackAsset)

    Gets the binding type for a track.

    Declaration
    public Type GetBindingType(TrackAsset track)
    Parameters
    Type Name Description
    TrackAsset track

    The track to retrieve the binding type from.

    Returns
    Type Description
    Type

    Returns the binding type for the specified track. Returns null if the track does not have binding.

    GetErrorText(TrackAsset, Object, TrackBindingErrors)

    Gets the error text for the specified track.

    Declaration
    public string GetErrorText(TrackAsset track, Object boundObject, TrackBindingErrors detectErrors)
    Parameters
    Type Name Description
    TrackAsset track

    The track to retrieve options for.

    Object boundObject

    The binding for the track.

    TrackBindingErrors detectErrors

    The errors to check for.

    Returns
    Type Description
    string

    An error to be displayed on the track, or string.Empty if there is no error.

    GetTrackColor(TrackAsset)

    Gets the color information of a track.

    Declaration
    public Color GetTrackColor(TrackAsset track)
    Parameters
    Type Name Description
    TrackAsset track
    Returns
    Type Description
    Color

    Returns the color for the specified track.

    GetTrackOptions(TrackAsset, Object)

    Implement this method to override the default options for drawing a track.

    Declaration
    public virtual TrackDrawOptions GetTrackOptions(TrackAsset track, Object binding)
    Parameters
    Type Name Description
    TrackAsset track

    The track from which track options are retrieved.

    Object binding

    The binding for the track.

    Returns
    Type Description
    TrackDrawOptions

    The options for drawing the track.

    IsBindingAssignableFrom(Object, TrackAsset)

    Override this method to validate if a binding for track can be determined from candidate.

    The default implementation of this method will return true if

    • candidate is not null or,
    • candidate is not part of a Prefab Asset or,
    • candidate is a Component that can be bound to track
    Declaration
    public virtual bool IsBindingAssignableFrom(Object candidate, TrackAsset track)
    Parameters
    Type Name Description
    Object candidate
    TrackAsset track

    TBD

    Returns
    Type Description
    bool

    True if a binding can be determined from candidate.

    See Also
    TrackBindingTypeAttribute
    TrackAsset

    OnCreate(TrackAsset, TrackAsset)

    Callback for when a track is created.

    Declaration
    public virtual void OnCreate(TrackAsset track, TrackAsset copiedFrom)
    Parameters
    Type Name Description
    TrackAsset track

    The track that is created.

    TrackAsset copiedFrom

    The source that the track is copied from. This can be set to null if the track is not a copy.

    OnTrackChanged(TrackAsset)

    Callback for when a track is changed.

    Declaration
    public virtual void OnTrackChanged(TrackAsset track)
    Parameters
    Type Name Description
    TrackAsset track

    The track that is changed.


    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Fields
      • DefaultTrackHeight
      • MaximumTrackHeight
      • MinimumTrackHeight
    • Methods
      • GetBindingFrom(Object, TrackAsset)
      • GetBindingType(TrackAsset)
      • GetErrorText(TrackAsset, Object, TrackBindingErrors)
      • GetTrackColor(TrackAsset)
      • GetTrackOptions(TrackAsset, Object)
      • IsBindingAssignableFrom(Object, TrackAsset)
      • OnCreate(TrackAsset, TrackAsset)
      • OnTrackChanged(TrackAsset)
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)