1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
using UnityEngine;
using UnityEngine.Timeline;
using UnityEngine.Playables;
public class PlayableDiractorMuteScript : MonoBehaviour {
PlayableDirector playableDirector;
private TimelineAsset someTimelineAsset;
public int number = 0;
// Use this for initialization
void Start () {
playableDirector = GetComponent<PlayableDirector>();
someTimelineAsset = (TimelineAsset)playableDirector.playableAsset;
MuteUnmuteTrack(number , true);
}
void MuteUnmuteTrack(int trackIndex , bool isMute)
{
// Get track from TimelineAsset
TrackAsset someTimelineTrackAsset = someTimelineAsset.GetOutputTrack(trackIndex);
// Change TimelineAsset's muted property value
someTimelineTrackAsset.muted = isMute;
double t = playableDirector.time; // Store elapsed time
playableDirector.RebuildGraph(); // Rebuild graph
playableDirector.time = t; // Restore elapsed time
}
}
| cs |
댓글
댓글 쓰기