Hi, i’m doing the options menu for the game (the resolutions) and i now have all the code that i need but i don’t know how to save it with the player prefs, basically I would like to save the resolution of the dropdown and the state of fullscreen between scenes. As now the code starts with a resolution but it doesn’t save the selected resolution (the text of the dropdown options, the resolutions itself remains between scenes) or the state toggle of the fullscreen when I change from the main menu to the game scene.
using UnityEngine;
using UnityEngine.UI;
public class setting_menu : MonoBehaviour
{
List widths = new List () {3840, 2560, 1920};
List heights = new List () {2160, 1440, 1080};
void Awake()
{
SetResolution(1);
}
public void SetFullscreen(bool isFullscreen)
{
Screen.fullScreen = isFullscreen;
}
public void SetResolution(int resolutionIndex)
{
bool fullScreen = Screen.fullScreen;
int width = widths[resolutionIndex];
int height = heights[resolutionIndex];
Screen.SetResolution(width, height, fullScreen);
}
}
I did this following a tutorial on Youtube
Thanks for the help!