Skip to main content
correction in code section
Source Link

I need to change the intensity value of my current Vignette effect depending in specific conditions.
So far I haven't been able to achieve this. Please help!

Image of what I want to achieve: enter image description here

My setup:

  • Unity 2019.3.5f1 with URP implemented
  • Post Processing Package (v2) installed
  • Scene with a GameObject + Volume component with Vignette and Bloom effect overrides added
  • A monobehaviour component script in the very same GameObject from above

My monobehaviour script:

using UnityEngine;
 using UnityEngine.Rendering.PostProcessing;
 
 public class PostProcessingHandler : MonoBehaviour
 {
   private PostProcessVolume _ppv;
   private Vignette _vignette;
 
   // Vignette intensity values
   [SerializeField, Range(0f, 1f)]
   private float _lowIntensity = 0.25f;
   [SerializeField, Range(0f, 1f)]
   private float _highIntensity = 0.5f;
 
   private void Start()
   {
     _ppv = GetComponent<PostProcessVolume>();
     Debug.Log("PostProcessingHandler"_ppv);
   }
 }

When I try to retrieve PostProcessingVolume component to get it's profile (and further layer manipulation) I always get "null".

Image of my setup: enter image description here

I've seen several guides/posts and even Unity documentation but I cannot get past that starting point of getting the PostProcessingVolume component, what am i missing?

I need to change the intensity value of my current Vignette effect depending in specific conditions.
So far I haven't been able to achieve this. Please help!

Image of what I want to achieve: enter image description here

My setup:

  • Unity 2019.3.5f1 with URP implemented
  • Post Processing Package (v2) installed
  • Scene with a GameObject + Volume component with Vignette and Bloom effect overrides added
  • A monobehaviour component script in the very same GameObject from above

My monobehaviour script:

using UnityEngine;
 using UnityEngine.Rendering.PostProcessing;
 
 public class PostProcessingHandler : MonoBehaviour
 {
   private PostProcessVolume _ppv;
   private Vignette _vignette;
 
   // Vignette intensity values
   [SerializeField, Range(0f, 1f)]
   private float _lowIntensity = 0.25f;
   [SerializeField, Range(0f, 1f)]
   private float _highIntensity = 0.5f;
 
   private void Start()
   {
     Debug.Log("PostProcessingHandler");
   }
 }

When I try to retrieve PostProcessingVolume component to get it's profile (and further layer manipulation) I always get "null".

Image of my setup: enter image description here

I've seen several guides/posts and even Unity documentation but I cannot get past that starting point of getting the PostProcessingVolume component, what am i missing?

I need to change the intensity value of my current Vignette effect depending in specific conditions.
So far I haven't been able to achieve this. Please help!

Image of what I want to achieve: enter image description here

My setup:

  • Unity 2019.3.5f1 with URP implemented
  • Post Processing Package (v2) installed
  • Scene with a GameObject + Volume component with Vignette and Bloom effect overrides added
  • A monobehaviour component script in the very same GameObject from above

My monobehaviour script:

using UnityEngine;
 using UnityEngine.Rendering.PostProcessing;
 
 public class PostProcessingHandler : MonoBehaviour
 {
   private PostProcessVolume _ppv;
   private Vignette _vignette;
 
   // Vignette intensity values
   [SerializeField, Range(0f, 1f)]
   private float _lowIntensity = 0.25f;
   [SerializeField, Range(0f, 1f)]
   private float _highIntensity = 0.5f;
 
   private void Start()
   {
     _ppv = GetComponent<PostProcessVolume>();
     Debug.Log(_ppv);
   }
 }

When I try to retrieve PostProcessingVolume component to get it's profile (and further layer manipulation) I always get "null".

Image of my setup: enter image description here

I've seen several guides/posts and even Unity documentation but I cannot get past that starting point of getting the PostProcessingVolume component, what am i missing?

Source Link

How to manipulate PostProcessing effects settings during execution with c#?

I need to change the intensity value of my current Vignette effect depending in specific conditions.
So far I haven't been able to achieve this. Please help!

Image of what I want to achieve: enter image description here

My setup:

  • Unity 2019.3.5f1 with URP implemented
  • Post Processing Package (v2) installed
  • Scene with a GameObject + Volume component with Vignette and Bloom effect overrides added
  • A monobehaviour component script in the very same GameObject from above

My monobehaviour script:

using UnityEngine;
 using UnityEngine.Rendering.PostProcessing;
 
 public class PostProcessingHandler : MonoBehaviour
 {
   private PostProcessVolume _ppv;
   private Vignette _vignette;
 
   // Vignette intensity values
   [SerializeField, Range(0f, 1f)]
   private float _lowIntensity = 0.25f;
   [SerializeField, Range(0f, 1f)]
   private float _highIntensity = 0.5f;
 
   private void Start()
   {
     Debug.Log("PostProcessingHandler");
   }
 }

When I try to retrieve PostProcessingVolume component to get it's profile (and further layer manipulation) I always get "null".

Image of my setup: enter image description here

I've seen several guides/posts and even Unity documentation but I cannot get past that starting point of getting the PostProcessingVolume component, what am i missing?