Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to assign VolumeParameter for namespace UnityEngine.Rendering in script

Discussion in 'High Definition Render Pipeline' started by Joshjarc, Nov 5, 2021.

  1. Joshjarc

    Joshjarc

    Joined:
    May 7, 2020
    Posts:
    5
    line 17 is not working. I can't simply assign it a float or assign it in inspector. Anyone know how?

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using UnityEngine.Rendering.HighDefinition;
    4. using UnityEngine.Rendering;
    5.  
    6. public class SkyController : MonoBehaviour
    7. {
    8.  
    9.     public HDRISky sky;
    10.  
    11.  
    12.     public VolumeParameter vol;
    13.     void Start()
    14.     {
    15.         sky = GetComponent<HDRISky>();
    16.  
    17.         vol = 4f;
    18.     }
    19.  
    20.     public void ChangeSky()
    21.     {
    22.         sky.desiredLuxValue.SetValue(vol);
    23.  
    24.  
    25.     }
    26. }
    27.  
     
  2. duxttyiyi

    duxttyiyi

    Joined:
    Aug 28, 2017
    Posts:
    9
    Code (CSharp):
    1. m_Volume.sharedProfile.TryGet<HDRISky>(out var Temp0);
    2.         //Debug.Log(Temp0.exposure);
    3.         //Temp0.multiplier = new MinFloatParameter(expmax, 1,true);
    4.         Temp0.desiredLuxValue = new FloatParameter(expmax, true);
    it can be done but it cannot refresh after the code runonce