Update SkyboxSwitcher.cs
This commit is contained in:
parent
b4b1da9cab
commit
c506e0572b
@ -21,6 +21,8 @@ public class SkyboxSwitcher : MonoBehaviour
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int currentSkyboxIndex = 0;
|
private int currentSkyboxIndex = 0;
|
||||||
|
|
||||||
|
private TMP_Dropdown Dropdown;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
skyboxes.Insert(0, RenderSettings.skybox); // add ubiquitous default skybox (should be current)
|
skyboxes.Insert(0, RenderSettings.skybox); // add ubiquitous default skybox (should be current)
|
||||||
@ -28,20 +30,24 @@ public class SkyboxSwitcher : MonoBehaviour
|
|||||||
// check StreamingAssets folder for additional skybox textures
|
// check StreamingAssets folder for additional skybox textures
|
||||||
skyboxPath = Path.Combine(Application.streamingAssetsPath, "SkyboxTextures");
|
skyboxPath = Path.Combine(Application.streamingAssetsPath, "SkyboxTextures");
|
||||||
StartCoroutine(AddSkyboxes());
|
StartCoroutine(AddSkyboxes());
|
||||||
|
|
||||||
|
Dropdown = GetComponent<TMP_Dropdown>();
|
||||||
ConfigManager.onConfigChanged += ApplyConfig;
|
ConfigManager.onConfigChanged += ApplyConfig;
|
||||||
ConfigManager.EnsureInitialization();
|
ConfigManager.EnsureInitialization();
|
||||||
ApplyConfig();
|
ApplyConfig();
|
||||||
}
|
}
|
||||||
void ApplyConfig()
|
void ApplyConfig()
|
||||||
{
|
{
|
||||||
if (ConfigManager.config.Skybox == 0)
|
if (ConfigManager.config.Skybox == 0)
|
||||||
useSkybox = false;
|
{
|
||||||
|
Room.SetActive(true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
useSkybox = true;
|
{
|
||||||
Room.SetActive(!useSkybox);
|
Room.SetActive(false);
|
||||||
|
currentSkyboxIndex = ConfigManager.config.Skybox-1;
|
||||||
currentSkyboxIndex = ConfigManager.config.Skybox-1;
|
SetSkybox();
|
||||||
SetSkybox();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator AddSkyboxes()
|
IEnumerator AddSkyboxes()
|
||||||
@ -73,6 +79,8 @@ public class SkyboxSwitcher : MonoBehaviour
|
|||||||
{
|
{
|
||||||
skyboxMat.SetTexture("_MainTex", texture);
|
skyboxMat.SetTexture("_MainTex", texture);
|
||||||
skyboxes.Add(skyboxMat);
|
skyboxes.Add(skyboxMat);
|
||||||
|
|
||||||
|
Dropdown.options.Add(new TMP_Dropdown.OptionData(file.Name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user