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

Skybox light reflect question

Discussion in 'Scripting' started by manlaikin1994, Jul 23, 2015.

  1. manlaikin1994

    manlaikin1994

    Joined:
    May 15, 2015
    Posts:
    179
    When i change the skybox in "Window -> Lighting -> Skybox"
    the light will affect to gameObject.

    However, when i add "Skybox" component in my main camera,
    there are no light affect with this way(it still according to " Window -> Lighting -> Skybox").

    I made my UI button in order to change my skybox. And i want the light effect through skybox. How can i do it through code, ty
     
    Last edited: Jul 23, 2015
  2. manlaikin1994

    manlaikin1994

    Joined:
    May 15, 2015
    Posts:
    179
  3. manlaikin1994

    manlaikin1994

    Joined:
    May 15, 2015
    Posts:
    179
  4. manlaikin1994

    manlaikin1994

    Joined:
    May 15, 2015
    Posts:
    179
  5. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
  6. manlaikin1994

    manlaikin1994

    Joined:
    May 15, 2015
    Posts:
    179
    Actually, i tried it before i ask. But it still didn't work.

    In Edit Mode with skybox - 10
    螢幕快照 2015-07-29 上午11.27.38.png

    In EditMode with skybox3 螢幕快照 2015-07-29 上午11.27.48.png


    In Edit mode with skybox 3 and change to skybox 10 through code
    螢幕快照 2015-07-29 上午11.28.12.png

    Scripts
    螢幕快照 2015-07-29 上午11.28.32.png

    You can see that is still absorbed my skybox 3 light after i change my skybox through code with render setting
     
  7. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    Reading the Documentation IS THE WAY TO GO.
     
    GroZZleR likes this.
  8. manlaikin1994

    manlaikin1994

    Joined:
    May 15, 2015
    Posts:
    179
    holy XXXX i success after i re-open the unity.

    In the beginning i just try
    Code (CSharp):
    1. void DynamicGI.UpdateEnvironment()
    2. {
    3. }
    4.  
    5. ///Actuallt, it should be
    6.  
    7. void Start
    8. {
    9.    DynamicGI.UpdateEnviroment();
    10. }
    11.  
    12. void UpdateEnviroment()
    13. {
    14.    RenderSettings.skybox = skyMat[3];
    15. }
     
    Last edited: Jul 29, 2015