Question about dropdown menu for resolutions

Updated on December 31, 2017 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on December 31, 2017

Hey everyone i’m new in unity game dev. . And i’ve been following some tutorials and trying to create some stuff. I’ve got this issue when i want to create a drop down menu where you can pick a resolution, this is the code i’m using but this is not showing anything. it just shows an empty drop down menu with no options. If anyone can help it will be amazing, and thank you! 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.UI;
public class SettingsMenu : MonoBehaviour {
public AudioMixer audioMixer;
public Dropdown resolutionDropdown;
public void SetVolume(float volume )
Resolution[] resolutions;
void Start()
resolutions = Screen.resolutions;
List<string> options = new List<string>();
int currentResolutionIndex =0;
for(int i = 0; i < resolutions.Length; i++)
string option = resolutions[i].width + "x" + resolutions[i].height;
if( resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height)
resolutionDropdown.value = currentResolutionIndex;

PS: Ignore the audio part, its for the volume ect..

Thank you!

  • Liked by