Last active
May 12, 2021 10:41
-
-
Save tsubaki/96821e6b61adf5c733914b069b624203 to your computer and use it in GitHub Desktop.
UnityのTimel inで、クリックしたらクリップの末まで移動する
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 UnityEngine; | |
using UnityEngine.Playables; | |
public class ClickToEndBehaviour : PlayableBehaviour | |
{ | |
private PlayableDirector director { get; set; } | |
public override void OnPlayableCreate(Playable playable) | |
{ | |
director = (playable.GetGraph().GetResolver() as PlayableDirector); | |
} | |
public override void ProcessFrame(Playable playable, FrameData info, object playerData) | |
{ | |
if (Input.GetMouseButtonDown(0)) | |
{ | |
var diff = playable.GetDuration() - playable.GetTime(); | |
director.time += diff; | |
} | |
} | |
} |
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 UnityEngine; | |
using UnityEngine.Playables; | |
using UnityEngine.Timeline; | |
public class ClickToEndClip : PlayableAsset, ITimelineClipAsset | |
{ | |
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) | |
{ | |
return ScriptPlayable<ClickToEndBehaviour>.Create (graph); | |
} | |
public ClipCaps clipCaps { get; } | |
} |
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 UnityEngine.Timeline; | |
[TrackColor (1f, 0.2794118f, 0.7117646f)] | |
[TrackClipType (typeof(ClickToEndClip))] | |
public class ClicktoEndTrack : TrackAsset{} |
Author
tsubaki
commented
Nov 13, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment