usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;usingUnityEngine.Playables;publicclassTimeLineDirector:MonoBehaviour{[SerializeField]privatePlayableDirector _director;privatefloat _animationTime =10f;// Start is called before the first frame updatevoidStart(){
_director.gameObject.SetActive(false);
_director.Stop();
_director.initialTime =0;
_animationTime =300/60f;}publicvoidPlay(){
_director.gameObject.SetActive(true);
_director.initialTime =0;
_animationTime =300/60f;
_director.Play();}// Update is called once per framevoidUpdate(){if(_director.time >= _animationTime){
_director.Stop();
gameObject.SetActive(false);}}}