Hey guys,
I am creating a UI with a dropdown menu, unfortunately when entering play mode, it doesn’t work.
Here is the hierarchy view (sorry about the redaction as it isn’t by choice):
I have one script attached:
public class UpdateOptionsDropDown : MonoBehaviour {
[SerializeField] private DropdownType type;
private Dropdown dropDown;
private void Awake()
{
dropDown = GetComponent<Dropdown>();
//InitializeDropDownValue();
dropDown.onValueChanged.AddListener(UpdateOptionsValue);
}
public void InitializeDropDownValue() // Once the drop down is created it takes in the value from the settings class.
{
switch (type)
{
case DropdownType.ANTI_ALIASING:
dropDown.value = GUIManager.instance.settings.AntiAliasing;
QualitySettings.antiAliasing = GUIManager.instance.settings.AntiAliasing;
break;
case DropdownType.LIGHT_SHADOW_MODIFIER:
dropDown.value = GUIManager.instance.settings.LightShadowModifier;
break;
}
}
private void UpdateOptionsValue(int _value)
{
switch (type)
{
case DropdownType.ANTI_ALIASING:
GUIManager.instance.settings.AntiAliasing = _value;
QualitySettings.antiAliasing = _value;
break;
case DropdownType.LIGHT_SHADOW_MODIFIER:
GUIManager.instance.settings.LightShadowModifier = _value;
break;
}
}
}
The funny thing is that when I put the “Options Panel” under an empty canvas and run the scene and I test it, it drops just fine. For some reason in the canvas above it doesn’t drop when I click it. Any ideas?
Note: I am using 5.6.0f3
Thanks in advance.