コード例 #1
0
        static AudioMixerPlayable CreateAudioBinding(PlayableGraph graph, AudioSource audioSource)
        {
            var mixerPlayable = AudioMixerPlayable.Create(graph, 1);
            var output        = (AudioPlayableOutput)graph.GetOutputByType <AudioPlayableOutput>(0);

            if (!output.IsOutputNull())
            {
                output.SetTarget(audioSource);
                output.SetSourcePlayable(mixerPlayable);
                Assert.IsTrue(output.IsOutputValid());
            }
            return(mixerPlayable);
        }
コード例 #2
0
        static AnimationMixerPlayable CreateAnimationBinding(PlayableGraph graph, Animator animator)
        {
            var mixerPlayable = AnimationMixerPlayable.Create(graph, 1);
            var output        = (AnimationPlayableOutput)graph.GetOutputByType <AnimationPlayableOutput>(0);

            if (!output.IsOutputNull())
            {
                output.SetTarget(animator);
                output.SetSourcePlayable(mixerPlayable);
                Assert.IsTrue(output.IsOutputValid());
            }
            return(mixerPlayable);
        }
コード例 #3
0
        void Setup1()
        {
            animator      = GetComponent <Animator>();
            playableGraph = animator.playableGraph;
            playableGraph.Stop();

            var playableOutput     = playableGraph.GetOutputByType <AnimationPlayableOutput>(0);
            var controllerPlayable = playableOutput.GetSourcePlayable();

            // Mixer
            var mixer = AnimationMixerPlayable.Create(playableGraph, 2, false);

            playableGraph.Connect(controllerPlayable, 0, mixer, 0);

            // Setup output
            playableOutput.SetSourcePlayable(mixer);
        }