当 PlayableDirector 组件停止时触发的事件。
为该事件添加事件处理程序,以便在 PlayableDirector 停止时收到通知。事件处理程序还会接收停止的 PlayableDirector。
当使用 PlayableBehaviour 时,此事件会在 PlayableBehaviour.OnBehaviourPause 和 PlayableBehaviour.OnGraphStop 之前触发。
using UnityEngine; using UnityEngine.Playables;
public class PlayableDirectorCallbackExample : MonoBehaviour { public PlayableDirector director;
void OnEnable() { director.stopped += OnPlayableDirectorStopped; }
void OnPlayableDirectorStopped(PlayableDirector aDirector) { if (director == aDirector) Debug.Log("PlayableDirector named " + aDirector.name + " is now stopped."); }
void OnDisable() { director.stopped -= OnPlayableDirectorStopped; } }