using System.Collections.Generic; using TMPro; using UnityEngine; public class FillDropdownWithDays : MonoBehaviour { public TMP_Dropdown dropdown; Dictionary daysPerMonth = new Dictionary(); private void Awake() { daysPerMonth.Add(0, 31); daysPerMonth.Add(1, 29); daysPerMonth.Add(2, 31); daysPerMonth.Add(3, 30); daysPerMonth.Add(4, 31); daysPerMonth.Add(5, 30); daysPerMonth.Add(6, 31); daysPerMonth.Add(7, 31); daysPerMonth.Add(8, 30); daysPerMonth.Add(9, 31); daysPerMonth.Add(10, 30); daysPerMonth.Add(11, 31); } public void FillDropdown(int month) { dropdown.ClearOptions(); List days = new List(); for (int i = 0; i < daysPerMonth[month]; i++) { days.Add((i+1).ToString()); } dropdown.AddOptions(days); } }