Blackbar under my game after using setResolution
Hey guys,
in my game i have this drop down field with resolutions,
my game runs fine in 1920 x 1080 when i select that from the configurator.
but when i disable the configurator and i select the 1920x1080 option from the field, my game does what its supposed to do, but it has a huge blackbar at the bottom, and the mouse position is of.
i use this code to set to 1920x1080:
Screen.SetResolution (1920,1080, true);
and this is the blackbar i was talking about
http://i66.tinypic.com/jkad60.png
the error you see is not related to this.
If anyone has an idea on how to fix, please tell, its kind of annoying me now.
thanks in advance,
-v3
Unfortunately I can't view the image any longer. It worked the first time I clicked the link, but subsequent clicks produce no image.
Sometime the website doenst work i gues, try reopen it? works fine for me
Answer by Statement · Nov 02, 2015 at 02:03 PM
You could try the solution in this answer, which suggest to wait until the end of the frame. Though it is a year old and may no longer be relevant.
Or triple check that your native resolution is actually what you feed it. Optionally, pass a preferred refresh rate.
I tried all that not working.
i have no clue what to do at the moment,
ps im using unity 5.2.0f3 (pro)
-v3
Could you output Screen.width and Screen.height into the development console?
Could you try it once without you calling SetResolution, where you just use the 1920x1080 option in the config window and once when calling SetResolution manually? This is just to sanity check that Unity doesn't choose some other resolution through the configuration window.
Your image is 1600x900 px (16:9 aspect), but the rendered portion is 1600x826 px.
If that was a screenshot that is unaltered, you're clearly not getting 1920x1080 (16:9).
You can also try enumerating all possible resolutions.
Im going to try that out, and il let you know what i find.
thanks for the help
What fixed the issue? So the next gal or guy who gets the same issue know what to do...
i used this code wich i 50% found and 50% got from the example u gave me.
Resolution[] resolutions;
public Dropdown dropdown$$anonymous$$enu;
void Start()
{
resolutions = Screen.resolutions;
//Screen.SetResolution(1920, 1080, true);
for (int i = 0; i < resolutions.Length; i++)
{
dropdown$$anonymous$$enu.options[i].text = ResToString(resolutions[i]);
dropdown$$anonymous$$enu.value = i;
dropdown$$anonymous$$enu.onValueChanged.AddListener(delegate { Screen.SetResolution(resolutions[dropdown$$anonymous$$enu.value].width, resolutions[dropdown$$anonymous$$enu.value].height, true); });
}
}
string ResToString(Resolution res)
{
return res.width + " x " + res.height;
}