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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

rendersettings.skybox

Discussion in 'Global Illumination' started by SAOTA, Feb 9, 2015.

  1. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    I'm having some issues assigning a skybox using unity 5.

    in unity 4.6.x I would just use.

    RenderSettings.skybox = sky1;

    where sky is a material references from the editor.

    It has no effect in unity 5. Skybox is not visible and no effect on enlighten...

    How would I change my skybox using a script and have enlighten and the camera see this new skybox?
     
  2. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    This is the code.

    public void MorningLights(NavItem pNavItem){
    Lights.SetActive (true);
    Lights2.SetActive (false);
    Lights3.SetActive (false);
    RenderSettings.skybox = sky1;

    }

    so skybox and lights change with RC1, but Enlighten does not update the GI information on the change.

    Any Ideas?
     
  3. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,673
    Go, to Windows->Lighting, and check if Ambient Source is set to Skybox
     
  4. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    It is. And it works with the skybox assigned in the editor. But changing the skybox during game with the script does not effect the assigned skybox, or realtime GI.
     
  5. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    Have you access to an oculus and head mounted leap motion so i can show you what I mean.

    When I assign an new skybox during the game the GI does not change. It still uses the skybox that was assigned in the editor as the source for ambient lighting.

    Is this normal?
     
  6. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    For anyone having similar issues. It seems that gradient based illumination is the way to go. Changing gradient at runtime changes GI in the environment.
     
  7. Tyen_

    Tyen_

    Joined:
    Jun 4, 2014
    Posts:
    12
    In Unity 5.2.1f1 I am seeing the same issue.

    Setting the RenderSettings.skybox at runtime does not cause the ambient source to update and correctly light the scene.

    Is this a bug?
     
  8. Tyen_

    Tyen_

    Joined:
    Jun 4, 2014
    Posts:
    12
    It appears that in order for the lighting to update, you need to set RenderSettings.skybox and then set RenderSettings.ambientmode to skybox. In that order.
    However the skybox reflections that would normally appear as a reflection on the Standard shader do not update.