using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class SettingResolution : MonoBehaviour { [SerializeField] private TMP_Dropdown resDropDown; private bool isFullScreen = true; private List filteredResolutions = new List(); // ÀÚÁÖ ¾²´Â ÇØ»óµµ ¸ñ·Ï private readonly Vector2Int[] commonResolutions = { new Vector2Int(1280, 720), new Vector2Int(1280, 768), new Vector2Int(1280, 800), new Vector2Int(1360, 768), new Vector2Int(1366, 768), new Vector2Int(1680, 1050), new Vector2Int(1920, 1080) }; private void Start() { Resolution[] allResolutions = Screen.resolutions; resDropDown.ClearOptions(); List options = new List(); foreach (var res in allResolutions) { foreach (var common in commonResolutions) { if (res.width == common.x && res.height == common.y) { // Áߺ¹ ¹æÁö if (!filteredResolutions.Exists(r => r.width == res.width && r.height == res.height)) { filteredResolutions.Add(res); options.Add($"{res.width} x {res.height}"); } } } } resDropDown.AddOptions(options); } public void ChangeResolution() { int index = resDropDown.value; Resolution res = filteredResolutions[index]; Screen.SetResolution(res.width, res.height, isFullScreen); } }