Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How do I change Post Processing Effects with a script URP

Discussion in 'Image Effects' started by LeShaDDoW2, May 5, 2022.

  1. LeShaDDoW2

    LeShaDDoW2

    Joined:
    Apr 1, 2021
    Posts:
    6
    I'm trying to enable a post processing effect in my volume profile when i'm in slow motion but how do I refrence that profile / volume?
    I am using the Universal Render Pipeline.
     
  2. OneOfMany

    OneOfMany

    Joined:
    Jun 11, 2015
    Posts:
    25
    Specify your question better. What has the speed of some motion to do with getting a reference to some post processing profile? I don't see how it's connected, or what you are asking - do some research to formulate more accurate question.
     
  3. LeShaDDoW2

    LeShaDDoW2

    Joined:
    Apr 1, 2021
    Posts:
    6
    Im making a slow motion effect but I want to make it that when the slow motion starts some post processing effects get changed so you can see that you're in slow motion better.
    Basicly im trying to enable and disable an effect through a method in a script
     
  4. OneOfMany

    OneOfMany

    Joined:
    Jun 11, 2015
    Posts:
    25
    I think you could use Cinemachine package for that, there is a solution built in for blending postprocessing profiles. Depends on the kind of a game you are making... I am not aware of any simple solution to do that, you would have to write a script that does that for you, and Cinemachine has it implemented already, watch some tutorials about it and you'll see if you could use it.
     
  5. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Here's how I change effects at runtime (my own effects, but the code applies to any volume component):
    Code (CSharp):
    1.         private void Start()
    2.         {
    3.             Volume volume = gameObject.GetComponent<Volume>();
    4.             PRISMEffects tmp;
    5.             if (volume.profile.TryGet<PRISMEffects>(out tmp))
    6.             {
    7.                 targetCUPPEffectsToChange = tmp;
    8.             }
    9.         }
    10.  
    11. //In Update()
    12. targetCUPPEffectsToChange.colorTemperature.value = originalColorTemp * t;
     
    Mr-C likes this.