- Home /
Unity5: Changing AmbientSkyColor doesn't change Skybox Color
Hello,
I am playing around with a new game mechanic but I've hit a simple problem with Unity 5.
I want to be able to make the scene very dark at certain points in the game. I reduce my lights' intensity property and I also change RenderSettings.ambientSkyColor to go towards black (0, 0, 0). This has a really nice effect except that the Skybox stays the same brightness throughout, meaning my models look like silhouettes against the skybox. What I'd like is for the skybox to darken also but I can't seem to find any way to do this. Can anyone help?
(In case anyone suggests: No I do not just want a black GUI plane infront of the camera that fades alpha because the player should still be able to slightly see the game objects).
Thank you for your time.
EDIT
I've also had a go at changing the ambientGroundColor and ambientEquatorColor in case these made any difference but they didn't seem to.
Answer by Cherno · Mar 10, 2015 at 02:43 AM
You can change the skybox' tint color:
RenderSettings.skybox.SetColor("_Tint", Color.black)
Be aware that any changes made during runtime will persist after the game stops running, so you need to call the OnApplicationQuit function and reset it if you don't want that.
void OnApplicationQuit() {
RenderSettings.skybox.SetColor("_Tint", defaultSkyTineColor);
RenderSettings.ambientLight = defaultAmbientLightColor;
}
Hi,
Thank you for your quick response but I'm getting an error saying "_Tint" doesn't exist as a color property for $$anonymous$$aterial. Could it be that I'm using Unity 5? (Because I did see that some other mentions to skybox's "_Tint" property.
I found this page on the docs: http://docs.unity3d.com/ScriptReference/$$anonymous$$aterial.GetColor.html which says that there are the following properties:
"_Color"
"_SpecColor"
"_Emission"
"_ReflectColor"
But I've just tried "_Color" and I'm getting the same error saying the material doesn't have such a color property.
Any ideas?
Hmm, even more interestingly, calling:
RenderSettings.skybox.color;
gives the error:
$$anonymous$$aterial doesn't have a color property "_Color" - UnityEngine.$$anonymous$$aterial:get_color()
So a see$$anonymous$$gly public property "color" calls .getColor("_Color"); underneath which apparently doesn't exist.
$$anonymous$$aybe I shouldn't have moved to Unity5 so quickly!
Any ideas?
Answer by samoO · Jun 16, 2015 at 05:43 PM
Hey, I know I am a bit late but I had a similar problem and after some try and error fun I found this solution:
To change the "Ground" color you can use:
RenderSettings.skybox.SetColor("_GroundColor", color);
To make your whole skybox darker you can use Exposure:
RenderSettings.skybox.SetFloat("_Exposure", val);
Be aware of the fact that this will change your Skybox Material even after you quit Play Mode. I haven't found out yet how to change the Sky Tint though, sorry about that...
Your answer
Follow this Question
Related Questions
RenderSettings.ambientProbe "empty", how to access? 0 Answers
skybox as ambient source unity 4 1 Answer
Need help with 24 Hour timing script. 1 Answer
Enviroment Lighting from Sky not updating in realtime 0 Answers
Toggling Ambient Light intensity 0 Answers