public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <PostProcessBehaviour> .Create(graph, template); PostProcessBehaviour clone = playable.GetBehaviour(); int layer = LayerMask.NameToLayer("PostProcessing"); if (postProcessProfile != null) { PostProcessVolume volume = PostProcessManager.instance.QuickVolume( layer, 1, postProcessProfile.settings.ToArray() ); volume.weight = 0; volume.priority = 1; volume.isGlobal = true; volume.profile = postProcessProfile; volume.gameObject.hideFlags = HideFlags.DontSave | HideFlags.NotEditable; volume.gameObject.name = $"PostProcessClip.CreatePlayable: QuickVolume [Profile {postProcessProfile.name}]"; clone.postProcessVolume = volume; } return(playable); }
public override void ProcessFrame(Playable playable, FrameData info, object playerData) { int inputCount = playable.GetInputCount(); for (int i = 0; i < inputCount; i++) { ScriptPlayable <PostProcessBehaviour> playableInput = (ScriptPlayable <PostProcessBehaviour>)playable.GetInput(i); PostProcessBehaviour input = playableInput.GetBehaviour(); float inputWeight = playable.GetInputWeight(i); input.postProcessVolume.weight = inputWeight; } }