diff --git a/com.unity.postprocessing/Documentation~/Manipulating-the-Stack.md b/com.unity.postprocessing/Documentation~/Manipulating-the-Stack.md index 553bb3bd709..22d0e2f0e25 100644 --- a/com.unity.postprocessing/Documentation~/Manipulating-the-Stack.md +++ b/com.unity.postprocessing/Documentation~/Manipulating-the-Stack.md @@ -7,37 +7,41 @@ This guide explains how to modify a post-processing script to create time-based Use the `QuickVolume` method to quickly spawn new volumes in the scene, to create time-based events or temporary states: ```csharp -[ public PostProcessVolume QuickVolume(int layer, float priority, params PostProcessEffectSettings[] settings) -] ``` The following example demonstrates how to use a script to create a pulsating vignette effect: ```csharp -[ using UnityEngine; using UnityEngine.Rendering.PostProcessing; + public class VignettePulse : MonoBehaviour { - PostProcessVolume m_Volume; - Vignette m_Vignette - void Start() + PostProcessVolume m_Volume; + Vignette m_Vignette; + + void Start() { // Create an instance of a vignette - m_Vignette = ScriptableObject.CreateInstance(); - m_Vignette.enabled.Override(true); - m_Vignette.intensity.Override(1f); + m_Vignette = ScriptableObject.CreateInstance(); + m_Vignette.enabled.Override(true); + m_Vignette.intensity.Override(1f); + // Use the QuickVolume method to create a volume with a priority of 100, and assign the vignette to this volume - m_Volume = PostProcessManager.instance.QuickVolume(gameObject.layer, 100f, m_Vignette); - void Update() + m_Volume = PostProcessManager.instance.QuickVolume(gameObject.layer, 100f, m_Vignette); + } + + void Update() { // Change vignette intensity using a sinus curve - m_Vignette.intensity.value = Mathf.Sin(Time.realtimeSinceStartup); + m_Vignette.intensity.value = Mathf.Sin(Time.realtimeSinceStartup); } - void OnDestroy() + + void OnDestroy() { - RuntimeUtilities.DestroyVolume(m_Volume, true, true); + RuntimeUtilities.DestroyVolume(m_Volume, true, true); } + } ```