Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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;