- Home /
Skybox material not working
I have a script where it will change the skybox material according to a int and it works besides the fact that it doesn't seem to change the ambient lighting in the scene. The skybox's I'm using have each have different settings for exposure and tint colour. How can i also update the lighting when i change the sky material? thanks
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class skyboxUpdater : MonoBehaviour {
public int skyInt;
public Material sky1;
public Material sky2;
// Use this for initialization
void Start () {
if (skyInt == 0) {
RenderSettings.skybox = sky1;
}else if (skyInt == 1) {
RenderSettings.skybox = sky2;
}
}
// Update is called once per frame
void Update () {
}
}
screen-shot-2016-11-23-at-45107-pm.png
(167.2 kB)
screen-shot-2016-11-23-at-45116-pm.png
(208.9 kB)
Comment
Best Answer
Answer by Adam-Mechtley · Nov 23, 2016 at 08:10 AM
The API documentation states "If you change the skybox in playmode, you have to use the DynamicGI.UpdateEnvironment function call to update the ambient probe." Have you tried doing that?