Answer the question
In order to leave comments, you need to log in
Distinct() does not work in the game, what should I do?
In the unity emulator, this function removes duplicates, and when assembling in the game, he does not want to remove
public Dropdown dd;
Resolution[] res;
void Start()
{
Resolution [] resolution = Screen.resolutions;
res = resolution.Distinct().ToArray();
string[] strRes = new string[res.Length];
for (int i = 0; i < res.Length; i++)
{
strRes[i] = res[i].width.ToString() + "x" + res[i].height.ToString();
}
dd.AddOptions(strRes.ToList());
}
Answer the question
In order to leave comments, you need to log in
Try to do something like this (only instead of ResolutionName the correct property name)
Screen.resolutions.Select(x => x.ResolutionName).Distinct();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question