Browse Source

Scale the fps counter so that it appears the same size at all resolutions

console
Nico de Poel 5 years ago
parent
commit
e62ac3f4a6
  1. 7
      Assets/Scripts/ConsoleTest.cs

7
Assets/Scripts/ConsoleTest.cs

@ -71,7 +71,12 @@ public class ConsoleTest : MonoBehaviour
private void OnGUI()
{
GUI.matrix = Matrix4x4.Scale(new Vector3(3, 3, 1));
int screenHeight = Screen.currentResolution.height;
if (screenHeight == 0)
screenHeight = 1080;
float screenScale = screenHeight / 720f;
GUI.matrix = Matrix4x4.Scale(new Vector3(screenScale, screenScale, 1));
if (fpsText != null)
GUI.Label(new Rect(10, 10, 1000, 100), fpsText);

Loading…
Cancel
Save