My settings panels have stopped working all of a sudden (they did work in the main menu, and during gameplay). When you open a dropdown menu (e.g. to set resolution), a new game object called a ‘blocker’ is instantiated and none of the options are intractable - they are either not there, or are greyed out. The ‘blocker’ could be a part of the dropdown system because the V-sync option still works (the only dropdown that does) - it appears when the menu is open, then vanishes when the menu is closed.
I’m a C# noob, so any advice would be much appreciated! I’ve hashed together bits of code from different sources. I can’t think of what has changed to cause this issue
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using System.IO;
public class SettingsController : MonoBehaviour {
public static int[] AliasingOptions = new int[4] { 0, 2, 4, 8 };
public static int[] ScreenResolutions = new int[4] { 0, 2, 4, 8 };
public Dropdown ResolutionDropdown;
Resolution[] resolutions;
public Slider volSlide;
public void SetQualitySettings(int value)
{
QualitySettings.SetQualityLevel(value);
}
public void SetVSyncSettings(int value)
{
QualitySettings.vSyncCount = value;
}
public void SetAntiAliasing(int value)
{
QualitySettings.antiAliasing = AliasingOptions[value];
}
public void ToggleFullScreen(bool value)
{
if (Screen.fullScreen == true)
Screen.fullScreen = false;
else
Screen.fullScreen = true;
}
void Start()
{
resolutions = Screen.resolutions;
for (int i = 0; i < resolutions.Length; i++)
{
ResolutionDropdown.options.Add(new Dropdown.OptionData(ResToString(resolutions*)));*
ResolutionDropdown.value = i;
ResolutionDropdown.onValueChanged.AddListener(delegate { Screen.SetResolution(resolutions[ResolutionDropdown.value].width, resolutions[ResolutionDropdown.value].height, true); });
}
}
void Update()
{
ChangeAudioVolume();
}
string ResToString(Resolution res)
{
return res.width + " x " + res.height;
}
void ChangeAudioVolume()
{
AudioListener.volume = volSlide.value;
}
}