void Awake() { _isInitialized = false; _isWritingScreenshot = false; _onWritingScreenshotComplete = () => { _isWritingScreenshot = false; }; _screenshotsPath = Path.Combine(UnityFileBrowserUtil.VoloAirsportDir.Value, "screenshots"); gameObject.AddComponent <ScreenResolutionNotifier>() .CurrentResolution .CombineLatest(_gameSettingsProvider.SettingChanges, (screenResolution, settings) => { return(new Resolution( width: Mathf.FloorToInt(Screen.width * settings.Graphics.ScreenshotMagnificationFactor), height: Mathf.FloorToInt(Screen.height * settings.Graphics.ScreenshotMagnificationFactor))); }) .DistinctUntilChanged() .Subscribe(resolution => { //Debug.Log("setting resolution to " + resolution.Width + "x" + resolution.Height); _screenshotResolution = resolution; _screenshotTexture = new Texture2D(resolution.Width, resolution.Height, TextureFormat.RGB24, mipmap: false, linear: true); }); }
public ScreenSettings(Resolution resolution, bool isWindowed) { Resolution = resolution; IsWindowed = isWindowed; }