Search Unity

Question Update clip name after playableasset updates

Discussion in 'Timeline' started by Tulsisvt, Jan 27, 2021.

  1. Tulsisvt

    Tulsisvt

    Joined:
    May 5, 2015
    Posts:
    28
    I have a timeline clipeditor class that updates my custom clip's name. The OnClipChanged method gets called before CreatePlayable method. So my clip name doesn't update correctly since the name variable is set in CreatePlayable method which is called after onclipchanged. Any way to work around this?
     
  2. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    I'm not sure I understand where the clip isn't getting updated.
    In the Timeline Window?

    CreatePlayable should have no impact on what is displayed
     
  3. Tulsisvt

    Tulsisvt

    Joined:
    May 5, 2015
    Posts:
    28
    I'm setting a name variable in CreatePlayable method. ClipEditor should update the clip's name from this name variable.

    This is my clip editor code:
    Code (CSharp):
    1.         public override void OnClipChanged(TimelineClip clip)
    2.         {
    3.             var m_clip = clip.asset as MyClip;
    4.  
    5.             if ( m_clip != null)
    6.             {
    7.            
    8.                 clip.displayName = m_clip.Name;
    9.             }
    10.             else
    11.             {
    12.                 clip.displayName = "Clip";
    13.             }
    14.         }
    So this method is executed before the m_clip.Name variable is updated in CreatePlayable method.
     
    Last edited: Feb 3, 2021
  4. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Yes, that's expected?
    You change the value, then the TimelineClip is updated (and OnClipChanged is called), then CreatePlayable is called, using the information from the TimelineClip to create a Playable.

    I don't understand what is wrong in this scenario