48 lines
1.5 KiB
C#
Executable File
48 lines
1.5 KiB
C#
Executable File
using TMPro;
|
|
using UnityEngine;
|
|
using System.Collections.Generic;
|
|
using UnityEngine.Rendering;
|
|
using UnityEngine.Rendering.PostProcessing;
|
|
|
|
public class SettingsPanel : MonoBehaviour
|
|
{
|
|
public GameObject settingsPanel;
|
|
public GameObject settingsPanelDeactivator;
|
|
public bool DisableSettingsPanelWhenLinkedGameobjectIsActivated = false;
|
|
public TMP_Dropdown GraphicsQualityDropdown;
|
|
public PostProcessVolume PostProcessVolume;
|
|
private void Update()
|
|
{
|
|
if (settingsPanel && DisableSettingsPanelWhenLinkedGameobjectIsActivated && settingsPanelDeactivator.activeInHierarchy)
|
|
{
|
|
settingsPanel.SetActive(false);
|
|
settingsPanelDeactivator.SetActive(false);
|
|
}
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
if (GraphicsQualityDropdown)
|
|
{
|
|
string[] QualityNames = QualitySettings.names;
|
|
List<TMP_Dropdown.OptionData> Options = new();
|
|
GraphicsQualityDropdown.ClearOptions();
|
|
foreach (string QualityName in QualityNames)
|
|
{
|
|
Options.Add(new TMP_Dropdown.OptionData(QualityName));
|
|
}
|
|
|
|
GraphicsQualityDropdown.AddOptions(Options);
|
|
GraphicsQualityDropdown.value = QualitySettings.GetQualityLevel();
|
|
}
|
|
}
|
|
|
|
public void SwitchQualitySettings(int index)
|
|
{
|
|
if (GraphicsQualityDropdown)
|
|
{
|
|
QualitySettings.SetQualityLevel(index);
|
|
}
|
|
}
|
|
}
|