Search Unity

Resolved How to work with URP post-processing in Unity Visual Scripting?

Discussion in 'Visual Scripting' started by MicrogamerCz, Aug 18, 2021.

  1. MicrogamerCz

    MicrogamerCz

    Joined:
    Aug 25, 2020
    Posts:
    13
    Hi, I want to change weight of URP post-processing Volume for different states in my game, but I don't see Volume in Type options (Project Settings) and I have all URP assemblies in Node library. Is it even possible to work with that in Visual Scripting?
     
    Ignacii likes this.
  2. GrandTheftEx

    GrandTheftEx

    Joined:
    Jan 14, 2013
    Posts:
    32
    Trying to figure this out myself and came across your post. Seems like we can't access the UnityEngine.Rendering.Universal assembly required to grab the Volume at runtime? Did you figure out a solution? Anyone out there can provide some help?

    Thanks!
     
    Ignacii likes this.
  3. MicrogamerCz

    MicrogamerCz

    Joined:
    Aug 25, 2020
    Posts:
    13
    Unfortunately I didn't. Only thing I could "work" were URP 2D lights, but almost all of their nodes/blocks do absolutely nothing. I searched through forums, youtube and other sources, but nothing was even near solving this problem.
     
  4. ericb_unity

    ericb_unity

    Unity Technologies

    Joined:
    Nov 24, 2017
    Posts:
    167
    This is how you will proceed.

    For Visualscripting package 1.6.0 and +

    1. Open the "Project Settings..." panel: Edit > Project Settings > Visual Scripting
    2. In the Node Library section, add Unity.RenderPipelines.Core.Runtime
      upload_2021-9-17_19-31-54.png
    3. Click on the Regenerate Units button under the Node Library section.
      upload_2021-9-17_19-33-19.png
    4. You will now be able to work with the properties that are in your Volume component. In this example, I have.
      - GameObject MyScript, which contains the script and object variable that references to the Volume.
      - GameObject Post-process Volume that contains the Volume component we want to interact with.
      upload_2021-9-17_19-42-3.png
    5. This is the result.
      URPWeight.gif
    Playing with those values is the easiest part of all. The tricky part will be when you want to work with components inside the Volume component, like changing the lens distortion.
     
    Ignacii and MicrogamerCz like this.
  5. MicrogamerCz

    MicrogamerCz

    Joined:
    Aug 25, 2020
    Posts:
    13
    Thank you sooo much! It's working!

    btw do you have anything useful for 2d lights? I have script, which should change angle of light (both inner and outer), color but it's not doing anything (and I got no errors, warnings or other logs)
    Part of my script:
     
    Last edited: Sep 19, 2021
  6. ericb_unity

    ericb_unity

    Unity Technologies

    Joined:
    Nov 24, 2017
    Posts:
    167
    I haven't tried to work with 2d at the moment. Shouldn't be to hard.
     
    MicrogamerCz likes this.
  7. ericb_unity

    ericb_unity

    Unity Technologies

    Joined:
    Nov 24, 2017
    Posts:
    167
    Look like you have an error with a variable not found.
    upload_2021-9-19_14-49-45.png

    I did a quick test with the light2D with the script at the same level as my light 2D component and it work well.
    upload_2021-9-19_14-56-41.png
     
    MicrogamerCz likes this.
  8. ericb_unity

    ericb_unity

    Unity Technologies

    Joined:
    Nov 24, 2017
    Posts:
    167
    Are you still getting issues?
     
  9. MicrogamerCz

    MicrogamerCz

    Joined:
    Aug 25, 2020
    Posts:
    13
    Fortunately I don't have any issues. After inspecting all my player scripts I found few conflicts where light angles were changing a few times per frame so it was just my foolishness.
    (As first thing I tried your test script and it was working while my player script wasn't, then I checked everything.)
     
  10. ericb_unity

    ericb_unity

    Unity Technologies

    Joined:
    Nov 24, 2017
    Posts:
    167
    Nice to ear, fortunately, in the future, we should have better graph debugging tools to help us find issues faster and more easily.
     
    MicrogamerCz likes this.
  11. Marou1

    Marou1

    Joined:
    Dec 13, 2021
    Posts:
    161
    Hello,

    Could you please provide more details on this part?

    What is the Volume script you are using?
    (I am not a programmer, I don't know how to create that script. Also, I am using HDRP, so I added Unity.RenderPipelines.HighDefinition.Runtime.)

    Thank you
     
  12. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    107
    Has anyone figured out the tricky part by any chance?
     
  13. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    107
    Seems like this should work but it doesn't for some reason: upload_2024-3-18_16-9-5.png