Created
July 29, 2019 17:03
-
-
Save ProjectX1989/f5a728388d97e26b772615ca7c48285e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SetLowRez : MonoBehaviour | |
{ | |
[SerializeField] protected bool doOnAwake = true; | |
[SerializeField] protected int xRes = 64, yRes = 64; | |
private int bigXRes, bigYRes; | |
private bool isLowRes; | |
private void SetSmallResolution() | |
{ | |
isLowRes = true; | |
bigXRes = Screen.currentResolution.width; | |
bigYRes = Screen.currentResolution.height; | |
Screen.SetResolution(xRes, yRes, true); | |
} | |
private void SetBigResolution() | |
{ | |
isLowRes = false; | |
Screen.SetResolution(bigXRes, bigYRes, true); | |
} | |
private void Awake() | |
{ | |
if (doOnAwake) | |
{ | |
SetSmallResolution(); | |
} | |
} | |
private void Update() | |
{ | |
if (Input.GetKeyDown(KeyCode.K)) | |
{ | |
if (isLowRes) | |
{ | |
SetBigResolution(); | |
} | |
else | |
{ | |
SetSmallResolution(); | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment