I am currently trying to use the new [Dropdown][1] feature included in Unity 5.2 and I would like to use it to enable a user to change their screen resolution upon selecting an option but I am having some issues. This can apparently be achieved using onValueChanged, when I select a resolution, it shows as selected, but does not change it as show below, I am running 1920 x 1080 even though 640 is selected:
[54158-screenshot-2015-09-12-114833.png*_|54158]
#EDIT
So i’ve been playing around with it for a while and managed to get it changing resolutions but when I change it, this happens [pic below] and the mouse position is completely out of sync with the screen, not sure what’s causing it.
[54160-screenshot-2015-09-12-135946.png*_|54160]
public class ScreenResolutions : MonoBehaviour
{
Resolution[] resolutions;
public Dropdown dropdownMenu;
void Start()
{
resolutions = Screen.resolutions;
//Screen.SetResolution(1920, 1080, true);
for (int i = 0; i < resolutions.Length; i++)
{
dropdownMenu.options_.text = ResToString(resolutions*);*_
dropdownMenu.value = i;
dropdownMenu.onValueChanged.AddListener(delegate { Screen.SetResolution(resolutions[dropdownMenu.value].width, resolutions[dropdownMenu.value].height, true); });
}
}
string ResToString(Resolution res)
{
return res.width + " x " + res.height;
}
}
_[1]: http://docs.unity3d.com/ScriptReference/UI.Dropdown.html*_
_
_*