- Home /
Load a different sky box in each world
I am currently making a game in which I have my camera in the first main menu scene whereas I am loading my world/environment asynchronously. My camera has script with DontDestroyOnLoad. The camera renders everything perfectly but it just can't render skybox of the latest loaded scene. It's still showing skybox of previous scene. I am using Unity 5.4.2 and Lighting window for creating skybox in each scene. My main menu doesn't have any Skybox. How can I make my camera to load skybox of every scene.
Answer by hexagonius · Nov 25, 2016 at 11:35 AM
Add a skybox component to the main camera and assign it the skybox you need:
He is "annoyed" because you just throw a link for him and used a one phrase message as answer.
ok, sorry, i try again than:
If you want to change the skybox during gameplay you're best off by adding a Skybox component to the camera you want the skybox to render. you can then add additional code that changes it on every scene load. But you don't have to of course. ;)
Answer by vfxjex · Mar 17, 2017 at 09:37 PM
RenderSettings.skybox = material;
public class LevelManager : MonoBehaviour {
[SerializeField]
Material[] skyboxes;
void Awake()
{
RenderSettings.skybox = skyboxes[yourSkyboxIndex];
}
}
Answer by BdarVirtu · Oct 23, 2020 at 12:31 PM
What if I want a different skybox per scene, not per camera? It makes a lot of sense to have that option, albeit, unfortunately, Unity doesn't seem to have that...