Version: 2020.3

描述

PlayableDirector 组件停止后所引发的事件。

向此事件添加一个事件处理程序,以便在 PlayableDirector 停止时接收相关通知。该事件处理程序还接收已停止的 PlayableDirector。

使用 PlayableBehaviour 时,系统将在 PlayableBehaviour.OnBehaviourPausePlayableBehaviour.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; } }