Unity脚本设置场景环境光,实现白天晚上切换
// 所以代码设置的中,假设ambientMode = AmbientMode.Trilight // Trilight == Triple Light 三重光的意思 // 设置为一个傍晚的样子 RenderSetting.ambientMode = AmbientMode.Trilight; RenderSetting.ambientSkyColor = Color.gray; RenderSetting.ambientEquatorColor = Color.black; RenderSetting.ambientGroundColor = Color.black;
或者自定义颜色
RenderSetting.ambientMode = AmbientMode.Trilight;
RenderSettings.ambientSkyColor = new Color(230/255f, 240/255f, 255/255f, 1/255f); RenderSettings.ambientEquatorColor = new Color(190/255f, 190/255f, 190/255f, 1/255f); RenderSettings.ambientGroundColor = new Color(229/255f, 229/255f, 229/255f, 1/255f);