Version: 2020.2

描述

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

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

使用 PlayableBehaviour 时,系统将在 PlayableBehaviour.OnBehaviourPause 之前引发此事件。

using UnityEngine;
using UnityEngine.Playables;

public class PlayableDirectorCallbackExample : MonoBehaviour { public PlayableDirector director;

void OnEnable() { director.paused += OnPlayableDirectorPaused; }

void OnPlayableDirectorPaused(PlayableDirector aDirector) { if (director == aDirector) Debug.Log("PlayableDirector named " + aDirector.name + " is now paused."); }

void OnDisable() { director.paused -= OnPlayableDirectorPaused; } }