Im looking for a way to mute a Track Group via script , so far what i was able to do is to loop through each tracks and mute them, how do i mute the parent Track Group by it name.
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
public class timeLineMuteUnMute : MonoBehaviour
{
public PlayableDirector director;
public TimelineAsset timelineAsset;
// Start is called before the first frame update
void Start()
{
MuteTracksInGroup("MY-GROUP");
}
void MuteTracksInGroup(string groupName)
{
director.playableAsset = timelineAsset; // Ensure director uses the TimelineAsset
// Loop through all tracks in the TimelineAsset
foreach (var track in timelineAsset.GetOutputTracks())
{
track.muted = false;
}
director.RebuildGraph(); // Rebuild the playable graph to reflect changes
}
}