From b84a1c0a21a7fa758f344a5f50c14b62ca3bd53f Mon Sep 17 00:00:00 2001 From: Mark Green Date: Thu, 28 Nov 2024 14:57:05 +0000 Subject: [PATCH 1/2] DOCG-4786 Fix code sample --- .../Documentation~/Manipulating-the-Stack.md | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) 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); } + } ``` From 624722c0e6f5499dc08ff99b4e8c1954f74f43cc Mon Sep 17 00:00:00 2001 From: Mark Green Date: Thu, 28 Nov 2024 15:04:27 +0000 Subject: [PATCH 2/2] DOCG-4713 Fix table formatting --- .../Documentation~/Manipulating-the-Stack.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/com.unity.postprocessing/Documentation~/Manipulating-the-Stack.md b/com.unity.postprocessing/Documentation~/Manipulating-the-Stack.md index 22d0e2f0e25..28cdad8565e 100644 --- a/com.unity.postprocessing/Documentation~/Manipulating-the-Stack.md +++ b/com.unity.postprocessing/Documentation~/Manipulating-the-Stack.md @@ -96,9 +96,10 @@ The above examples demonstrate how to create new effects and Volumes at runtime, - You must manually destroy the profile when you don't need it anymore The `PostProcessProfile` class contains the following utility methods to help you manage assigned effects: + | Utility method | **Description** | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [`T AddSettings()`](...api/UnityEngine.Rendering.PostProcessing.PostProcessProfile.html#UnityEngine_Rendering_PostProcessing_PostProcessProfile_AddSettings__1) | Creates, adds and returns a new effect of type `T` to the profile. It throws an exception if it already exist | +| [`T AddSettings()`](api/UnityEngine.Rendering.PostProcessing.PostProcessProfile.html#UnityEngine_Rendering_PostProcessing_PostProcessProfile_AddSettings__1) | Creates, adds and returns a new effect of type `T` to the profile. It throws an exception if it already exist | | [`PostProcessEffectSettings AddSettings(PostProcessEffectSettings effect)`](api/UnityEngine.Rendering.PostProcessing.PostProcessProfile.html#UnityEngine_Rendering_PostProcessing_PostProcessProfile_AddSettings_UnityEngine_Rendering_PostProcessing_PostProcessEffectSettings_) | Adds and returns an effect that you created to the profile. | | [`void RemoveSettings()`](api/UnityEngine.Rendering.PostProcessing.PostProcessProfile.html#UnityEngine_Rendering_PostProcessing_PostProcessProfile_RemoveSettings__1) | Removes an effect from the profile. It throws an exception if it doesn't exist. | | [`bool TryGetSettings(out T outSetting)`](...api/UnityEngine.Rendering.PostProcessing.PostProcessProfile.html#UnityEngine_Rendering_PostProcessing_PostProcessProfile_TryGetSettings__1___0__) | Gets an effect from the profile, returns `true` if it found a profile, or `false` if it did not find a profile. |