Last active
May 14, 2018 09:24
-
-
Save tsubaki/be5c7a720423a30bc12e9a1f15376fcb to your computer and use it in GitHub Desktop.
クリップのから抜けるときにPlayableDirectorをPauseする。外部からResumeを呼び出し復帰する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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