Search Unity

Muted Animation Tracks still generate Events

Discussion in 'Timeline' started by MikeChr, Oct 7, 2018.

  1. MikeChr

    MikeChr

    Joined:
    Feb 2, 2018
    Posts:
    43
    Hello. I am finding that muted animation tracks still generates AnimationEvents when the TimeLine cursor is dragged or positioned. Is this a bug?

    I was hoping disable the clip's events when the track is disabled. Is there a suggested method of disabling the execution of a track / clip's events?
    Thanks.
     
  2. MikeChr

    MikeChr

    Joined:
    Feb 2, 2018
    Posts:
    43
    Here is the answer...
    After the tracks are muted, the director's playable graph must be rebuilt.

    Code (CSharp):
    1.             TimelineAsset ta = (TimelineAsset)director.playableAsset;
    2.             foreach (TrackAsset trackAsset in ta.GetOutputTracks()) {
    3.                 foreach (PlayableBinding binding in trackAsset.outputs)
    4.                     if (binding.outputTargetType == typeof(Animator)) {
    5.                         trackAsset.muted = true;
    6.                     }
    7.             }
    8.             director.RebuildGraph();
    9.  
     
    Rukha93 and angusmf like this.