Esempio n. 1
0
 void Start()
 {
     // Load reference from last scene if needed
     nonStaticSettings = settings;
     if (!initializedResolution)
     {
         initializedResolution = true;
         // GetCurrentAppResolution may only be called from Start() and Awake(). This is why it is done here.
         Settings.GraphicSettings.resolution = ApplicationUtils.GetScreenResolution();
     }
 }
Esempio n. 2
0
 public ScreenResolutionPickerControl(ItemPicker itemPicker)
     : base(itemPicker, GetItems())
 {
     GetLabelTextFunction = item => $"{item.Width} x {item.Height} ({item.RefreshRate} Hz)";
     if (Application.isEditor)
     {
         Selection.Value = Items[0];
     }
     else
     {
         ScreenResolution currentScreenResolution = ApplicationUtils.GetScreenResolution();
         if (!TrySelectItem(currentScreenResolution, false))
         {
             Selection.Value = GetBestMatchingScreenResolution(currentScreenResolution);
         }
     }
     Selection.Subscribe(newValue => SettingsManager.Instance.Settings.GraphicSettings.resolution = newValue);
 }