Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Resolved Can I receive a callback when I create a track in timeline

Discussion in 'Timeline' started by sans108, Jan 25, 2022.

  1. sans108

    sans108

    Joined:
    Apr 1, 2021
    Posts:
    13
    Hi,
    I want to add my CustomTrack automaticly when I create an AnimationTrack in timeline, Is there has functions called "OnCreateTrack" or something I can get in timeline?
    Does someones know that?
    Thanks!
     
  2. sans108

    sans108

    Joined:
    Apr 1, 2021
    Posts:
    13
    Yes, I got a way to do this by myself.
    Just add a script:
    Code (CSharp):
    1. [CustomTimelineEditor(typeof(AnimationTrack))]
    2.     public class AnimationTrackEditor : TrackEditor
    3.     {
    4.         public override void OnCreate(TrackAsset track, TrackAsset copiedFrom)
    5.         {
    6.             //Do something
    7.         }
    8.     }
    And you just can do whatever you want in OnCreate. Great job unity !!
     
    julienb likes this.