Hi, I’m modifying my inspector appearance, and would like to create text labels that runs vertically, to give the same look as the vertical texts found in Physics Manager (in the Layer Collision Matrix). I’ve glanced through GUILayoutOption and GUISkin and had no luck. Could anyone give me some help on this? Thanks!
Well, you would need to rotate the GUI.matrix by 90°. Here’s the essential part of the PhysicsManagerInspector:
for (int j = 0; j < 32; j++)
{
if (LayerMask.LayerToName(j) != string.Empty)
{
float num3 = (float)(130 + (num - num2) * 16) - (topmostRect.width + scrollPos.x);
if (num3 < 0f)
{
num3 = 0f;
}
Vector3 pos = new Vector3((float)(130 + 16 * (num - num2)) + vector.y + vector.x + scrollPos.y - num3, vector.y + scrollPos.y, 0f);
GUI.matrix = Matrix4x4.TRS(pos, Quaternion.identity, Vector3.one) * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0f, 0f, 90f), Vector3.one);
if (SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9.0"))
{
GUI.matrix *= Matrix4x4.TRS(new Vector3(-0.5f, -0.5f, 0f), Quaternion.identity, Vector3.one);
}
GUI.Label(new Rect(2f - vector.x - scrollPos.y, scrollPos.y - num3, 100f, 16f), LayerMask.LayerToName(j), "RightLabel");
num2++;
}
}
GUI.matrix = Matrix4x4.identity;
The PhysicsManagerInspector uses an internal class called LayerMatrixGUI which is responsible for drawing the collision matrix.
hi… You can take string and use for loop then it will possible.
function OnGUI () {
GUILayout.Label(VerticalText("Hello"));
}
function VerticalText (input : String) : String {
var sb = new System.Text.StringBuilder(input.Length*2);
for (var i = 0; i < input.Length; i++) {
sb.Append(input*).Append("
");*
}
return sb.ToString();
}
Actually i got that code from [here][1]. better to Google for more info [2] .i’ll convert code to c# if u want.Thank you.
[1]: Vertical Text - Questions & Answers - Unity Discussions
[2]: Google