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

Changing volume parameters with script

Discussion in 'Scripting' started by Gigglebooster, Sep 9, 2020.

  1. Gigglebooster

    Gigglebooster

    Joined:
    Jan 24, 2019
    Posts:
    27
    I'm trying to write a script that changes the intensity of my chromatic abbrasion but not having much luck. I'm finding instructions for the old post processing stack stuff but it doesn't seem to be working with the newer versions of Unity. Anyone know how to do this? thx
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    Have you identified the specific API calls and looked them up in the current documentation for the version of the stack you're using, perhaps searched that documentation for possibly-renamed methods and/or properties?
     
  3. Gigglebooster

    Gigglebooster

    Joined:
    Jan 24, 2019
    Posts:
    27
    I'm pretty new to C# so the documentation can be a bit confusing, yes I have tried that though. I'm trying to do something like this, I think I'm on the right track but it's giving me an error in the 2nd line of the start function:

    using UnityEngine.Rendering.Universal;

    public class Player : MonoBehaviour
    {
    public GameObject volume;
    private ColorAdjustments colorAdjustments;


    private void start()
    {
    colorAdjustments = volume.GetComponent<ColorAdjustments>();
    colorAdjustments.postExposure.SetValue(2.0f);
    }