
특정 해상도 이상, 이하로 설정하려면
resolutions에 담기기 전에
if (resolution.width >= 1280 && resolution.height >= 720)
이렇게 조건을 사용하여 특정 해상도만 걸러낼 수 있다.
public void InitResolutionList() // 초기 해상도 목록 설정
{
// Screen.resolutions에서 사용 가능한 모든 해상도(내 모니터 해상도 목록)를 가져옴
Resolution[] availableResolutions = Screen.resolutions;
for (int i = 0; i < availableResolutions.Length; i++)
{
Resolution resolution = availableResolutions[i];
// "1920 x 1080"처럼 표시
string resolutionText = resolution.width + " x " + resolution.height;
if (uniqueResolution.Add(resolutionText)) // 중복된 해상도 문자열이 아니라면
{
if (resolution.width >= 1280 && resolution.height >= 720)
{
resolutions.Add(resolution); // 리스트에 해상도 추가
// 현재 사용자의 모니터 해상도와 설정에 있는 해상도와 일치하면
if (resolution.width == Screen.currentResolution.width && resolution.height == Screen.currentResolution.height)
{
optimalResolutionIndex = resolutions.Count - 1; // 해상도 인덱스 번호 저장
resolutionText += " *"; // "1920 x 1080 *"같이 표시
}
// resolutions와 resolutionTextList의 개수를 일치시킴
resolutionTextList.Add(resolutionText);
}
}
}
currentIndex = PlayerPrefs.GetInt(ResolutionIdxString, GetOptimalResolutionValue());
SetResolution(currentIndex);
}