Last active
November 20, 2019 16:51
-
-
Save Josef212/30150443e69ce46219485114505390db to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private void OnGUI() | |
{ | |
Matrix4x4 oldMatrix = GUI.matrix; | |
float scale = 2f; | |
int linesCount = 0; | |
float lineHeight = 20f; | |
Rect areaRect = new Rect() | |
{ | |
width = Screen.width * 0.333f / scale, | |
height = lineHeight * linesCount / scale, | |
x = 0, | |
y = (Screen.height - height) / scale | |
}; | |
GUIStyle backgroundStyle = new GUIStyle() | |
{ | |
normal = new GUIStyleState() | |
{ | |
background = Texture2D.whiteTexture | |
} | |
}; | |
GUI.matrix = Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, Vector3.one * scale); | |
GUILayout.BeginArea(areaRect, backgroundStyle); | |
GUI.contentColor = Color.black; | |
// ------------------------------------------- | |
// ------------------------------------------- | |
GUILayout.EndArea(); | |
GUI.matrix = oldMatrix; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment