So similar to my music issue,i don’t know how to make it so the skybox changes when you enter a new area
Could anybody help?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SkyBoxManager : MonoBehaviour {
// Use this for initialization
void Start ()
{
RenderSettings.skybox = yourSkyboxMaterial;
DynamicGI.UpdateEnvironment();
}
// Update is called once per frame
void Update () {
}
}
“yourSkyboxMaterial does not exist in the current context”
You can also use a skybox component attached to the camera itself.
You’ve trying to use a variable that you haven’t declared.
public class SkyBoxManager : MonoBehaviour {
public Material yourSkyboxMaterial;
// the rest of your code
}
i am already using that actually
Alright that worked,so now all i do is select the material i want?
or do i need to apply it to certain objects and have colliders,then do the above?
I’m not really sure what you’re asking. You don’t need to do anything else to change the skybox except for those two lines of code:
RenderSettings.skybox = material;
DynamicGI.UpdateEnvironment(); // this corrects lighting issues that reflect from the sky
If you want it to happen on collision with certain objects or something, you’ll need to add that functionality.