Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active May 14, 2018 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/be5c7a720423a30bc12e9a1f15376fcb to your computer and use it in GitHub Desktop.
Save tsubaki/be5c7a720423a30bc12e9a1f15376fcb to your computer and use it in GitHub Desktop.
クリップのから抜けるときにPlayableDirectorをPauseする。外部からResumeを呼び出し復帰する
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
public class StopTheGame : PlayableBehaviour
{
public PlayableDirector director;
public override void OnBehaviourPause(Playable playable, FrameData info)
{
//何故か最初のフレームに呼ばれる(info.FrameIDは0ではない)
if( playable.GetTime() != 0 )
director.Pause ();
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;
[System.Serializable]
public class StopTheGameAsset : PlayableAsset
{
public override Playable CreatePlayable(PlayableGraph graph, GameObject go) {
var playable = ScriptPlayable<StopTheGame>.Create (graph);
var behaviour = playable.GetBehaviour ();
behaviour.director = go.GetComponent<PlayableDirector> ();
return playable;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment