- Home /
A problem with the dropdown items
Hey guys, I have a problem with the dropdown items, they're not showing up. I am making a setting menu to my game, and wanted to add the resolution that my screen supports to the dropdown.
Here's the code I wrote:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
 public class SetResolutions : MonoBehaviour
 {
     Resolution[] resolutions;
     List<Dropdown.OptionData> resolutionDatas;
 
     // Start is called before the first frame update
     void Start()
     {
         resolutions = Screen.resolutions;
         resolutionDatas = new List<Dropdown.OptionData>();
 
         for (int i = 0; i < resolutions.Length; i++)
         {
             resolutionDatas.Add(new Dropdown.OptionData());
             resolutionDatas[i].text = resolutions[i].width.ToString() + " x " + resolutions[i].height.ToString();
         }
 
         GetComponent<Dropdown>().options = resolutionDatas;
     }
 }
Here's what the dropdown looks like in game:
 Anyone else having this issue or know if I'm doing something wrong?
 Anyone else having this issue or know if I'm doing something wrong?
 
                 
                issue.png 
                (352.2 kB) 
               
 
              
               Comment
              
 
               
              Have you tried
 resolutionDatas.Add(new Dropdown.OptionData(resolutions[i].width.ToString() + " x " + resolutions[i].height.ToString()));
Your answer
 
 
             Follow this Question
Related Questions
Making a blocker like dropdown menu for another gameobject. 0 Answers
Does anyone know how to make a Dropdown inside an element of another Dropdown? 0 Answers
how to keep dropdown's tempelate at the centre of the screen regarless of position of dropdown bar ? 1 Answer
Dropdown not showing after canvas set active 6 Answers
New dropdown menu sample 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                