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.

Resolved How to change Scene Settings values from c #? (HDRP)

Discussion in 'High Definition Render Pipeline' started by DxMax, May 16, 2020.

  1. DxMax

    DxMax

    Joined:
    Mar 11, 2020
    Posts:
    3
    Captura de pantalla de 2020-05-16 00-21-37.png
    I am trying to change the values of a "Scene Settings" from c #. but I am not understanding how to do it.

    create a "case" where if it is daytime have a lighting and a cubeMap HDRI different from if it were at night, change exposure, rotation, Indirect Light, fog, etc etc.

    try to do things like import UnityEngine.Experimental.Rendering.HDPipeline
    and get the volume component with: Volume volume = gameObject.GetComponent<Volume>();

    or do something like that: SkySettings.HDRISky.exposure = 0f;

    but nothing worked, it only gives errors like "volume was not found" or things like that. I already searched and found nothing. I'm going to keep trying but capable someone knew what I was doing wrong.

    I use unity 2018 with HDRP 4.10 preview on Ubuntu 18.04lts
    I use the 2018 version because it is lts. I do not know if it is convenient for me to pass the project to the 2019 version and a new HDRP
     
  2. DxMax

    DxMax

    Joined:
    Mar 11, 2020
    Posts:
    3
    I found the problem. was wearing "using UnityEngine.Experimental.Rendering.HDPipeline;"
    instead of: "using UnityEngine.Experimental.Rendering;"

    that's why I couldn't find the "volume"

    instead of changing value for value. make 2 "VolumeProfile" and with this code change them. it worked for me if I consider it resolved

    this.transform.GetComponent<Volume>().profile = Resources.Load("SceneSettings/SceneSetNight") as VolumeProfile;