public void UpdateResolution(int newSize) { if (camera.targetTexture != null) { camera.targetTexture.Release(); } currentSize = Mathf.Clamp(newSize, minSize, maxSize); //audio //audioMixer.SetFloat("DistortionValue", audioDistortCurve.Evaluate((float)currentSize/maxSize)); audioRegular.SetVolume((float)currentSize / maxSize); audioAlternate.SetVolume(1f - (float)currentSize / maxSize); int biggest = aspectRatio.x > aspectRatio.y ? aspectRatio.x : aspectRatio.y; int width = (int)(currentSize * (float)aspectRatio.x / biggest); int height = (int)(currentSize * (float)aspectRatio.y / biggest); RenderTexture tex = new RenderTexture(width, height, 32); tex.filterMode = FilterMode.Point; tex.depth = 32; tex.antiAliasing = 1; camera.targetTexture = tex; screenRawImage.texture = tex; }