public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
        {
            ScriptPlayable <MidiEventPlayableBehaviour> playable = ScriptPlayable <MidiEventPlayableBehaviour> .Create(graph);

            MidiEventPlayableBehaviour behaviour = playable.GetBehaviour();

            behaviour.clip  = clip;           //clip.Resolve( graph.GetResolver() );
            behaviour.tempo = tempo;

            return(playable);
        }
Exemple #2
0
        protected override Playable CreatePlayable(PlayableGraph graph, GameObject go, TimelineClip clip)
        {
            PlayableDirector timeline = go.GetComponent <PlayableDirector>();
            ScriptPlayable <MidiEventPlayableBehaviour> playable = ScriptPlayable <MidiEventPlayableBehaviour> .Create(graph);

            MidiEventPlayableBehaviour behaviour = playable.GetBehaviour();

            // Assign the VideoPlayer (that is binded the track) to VideoPlayableBehaviour.
            MidiEventPlayer player = timeline.GetGenericBinding(this) as MidiEventPlayer;

            behaviour.player = player;

            // Assign VideoClip to VideoPlayableBehaviour.
            MidiEventPlayable midiPlayable = clip.asset as MidiEventPlayable;

            behaviour.clip  = midiPlayable.clip;           //midiPlayable.clip.Resolve( graph.GetResolver() );
            behaviour.tempo = midiPlayable.tempo;

            return(playable);
        }