Skip to content

Instantly share code, notes, and snippets.

@Josef212
Last active November 20, 2019 16:51
Show Gist options
  • Save Josef212/30150443e69ce46219485114505390db to your computer and use it in GitHub Desktop.
Save Josef212/30150443e69ce46219485114505390db to your computer and use it in GitHub Desktop.
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