- Home /
Ambient source
Hi I wondered if it was possible to be able to change ambient source from color to skybox through script? I was thinking of changing it depending on certain events but I can't find a way to do it.
Thanks!
Answer by maxoja · Sep 18, 2018 at 10:53 PM
I think this is the line of code that you are looking for.
Camera.main.clearFlags = CameraClearFlags.Skybox;
Here below is the reference URL
https://docs.unity3d.com/ScriptReference/Camera-clearFlags.html
https://docs.unity3d.com/ScriptReference/CameraClearFlags.html
Hi, thank you for that but it doens't seem to be working? It was for the lighting tab where there's an option between the ambient source being between color or skybox. I ran the script in game and it still uses color?
Sorry for my inaccuracy of answering your question. I am not sure that it will word but what about this snippet?
RenderSettings.ambient$$anonymous$$ode = Ambient$$anonymous$$ode.SkyBox;
Indeed, I am quite not sure what is your purpose in doing this. Why do you need to do that through lightning settings ins$$anonymous$$d of camera settings.
I believe that environment lightning settings should only affect the source of light radiation that will transmit and bounce or reflect on objects in your scene, not how you will see farthermost surroundings.
Your answer
Follow this Question
Related Questions
Layer based Ambient Lighting 1 Answer
Turn off ONLY ambient lighting for just one object? 1 Answer
Scene is not pitch black when I set the Ambient Light Color to Black. 1 Answer
rendersettings.ambientintensity not updating in scene in play mode?! 2 Answers
Unity5: Changing AmbientSkyColor doesn't change Skybox Color 2 Answers