Vertical text (90 degree rotation of horizontal text)

Is there are way to rotate text in a label 90 degress so it will be vertical instead of horizontal in UnityGUI?

Regards,
Marc

Yes. Setting the value of GUI.Matrix will allow you to do arbitrary transforms of your GUI (buttons, labels, etc)

The reference point for the transformations are the center of the screen?

EDIT: NVM i figued it out (it is center of screen). Thanks!

I am getting a “bug” while using transformations. I want to create a Box rotated 45º and placed in the middle of the screen. My initial thought was to center it on zero and then create a matrix that rotated it 45º and moved it to the center of the screen:

Matrix4x4 m = Matrix4x4.identity;
m.SetTRS(new Vector3(Screen.width/2, Screen.height/2), Quaternion.Euler(0,0,45), new Vector3(1,1,1));
GUI.matrix = m;
GUI.Box( new Rect(-50, -50 , 100, 100), "");
GUI.matrix = Matrix4x4.identity;

However, this does not work because GUI stuff that is out of the screen is clipped out (i.e. the (-50, -50) to (0,0) of the box is cut out).
This means that I can’t rotate something around its center. Is this a bug? Does this mean that if I want to rotate something around its center I need to create it from (0,0), rotate it, and then try to figure out exactly what pixels I need to subtract from the translation to make it look like it rotated around its axis?

Regards,
Afonso

Well, I didn’t find any information about this, is this a bug or not? It seems like a bug to me. At this moment, the way I did it was by multiplying two matrixes in order to first change where it will rotate, then rotate it, and then move it back. I would like some clarification about this please.

For anyone trying to rotate a GUI element around the middle of it, here is the only “clean” way I found do it:

Matrix4x4 m1 = Matrix4x4.identity;
Matrix4x4 m2 = Matrix4x4.identity;
		
m2.SetTRS(new Vector3(200,200,0), Quaternion.Euler(0,0,aux), Vector3.one);
		
aux += 10f*Time.deltaTime; // aux is just to see it spin
if( aux > 360f )
	aux = 0.0f;

m1.SetTRS( new Vector3(-50, -50, 0), Quaternion.identity, Vector3.one );

GUI.matrix = m2*m1;

GUI.Box( new Rect(0,0 , 100, 100), "Hello My Friends!");

GUI.matrix = Matrix4x4.identity;