I created a menu so players can change resolution.
In the editor it’s fine and only shows options of 165 hz refresh rate, but when I build the game I get a full list as you can see on the image that includes every refresh rate option.
What is the best way around this?
I want to have a list with only resolutions using the current refresh rate the user has. Just like it does in the editor.
How do I know what refresh rate I want? I don’t know what sort of refresh rates people have. I don’t mind 75, 90, 120 etc. I just want one option and thats the refresh rate they use in general.
Do I have to go through them all and remove the lowest onces?
Just seem like a thing that should be easier to get around.
Look at all of the resolutions from Screen.resolutions, pick the highest refresh rate, and only show resolutions with that highest rate*.*
Maybe do a hybrid approach. Pick 1. or 2., but give the user a checkbox like “show all refresh rates”, which will update the list to include all of them.
Sounds good, I will try that way next time I’m working on the project
thanks for good input!
Just throwing it out there - The reason I don’t want to show all is because people might have a list like mine, where its +140 different choices. It looks kinda bad
I’m running into the exact same problem. Did you figure out a solution that worked for you? I’ve tried different things to try and remove any refresh rates that don’t match the current refresh rate but can’t seem to get it to work. So I start working on other stuff and every time I come back to this problem I can’t seem to make any progress.
void FixResolutionDropdown()
{
List options = new List();
string option;
int currentResolutionIndex = 0;
int refreshRate = refreshRates[refreshRateDropdown.value];
List resolutionsOptions = new List();
resolutionsOptions.AddRange(resolutions.Where(resolution => resolution.refreshRate == refreshRate).ToList());
int i = 0;
foreach (Resolution resolution in resolutionsOptions)
{
option = resolution.width + " x " + resolution.height;// + “, " + resolution.refreshRate + " hz”;
options.Add(option);
if (resolutionsOptions_.width == Screen.width && resolutionsOptions*.height == Screen.height)_ currentResolutionIndex = i; i++;
_}_ resolutionDropdown.ClearOptions(); resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue();
_}*_
Hello there! I saw this here while I was working on this issue recently. khold93, could you please share with me the code you created to start this discussion?
You wrote a really nice code and it would be great if I could reach that code right now.
I would be very happy if you share the code with me. good day!