The way to rotate gui-elements isn’t exactly straight-forward in unity… But after some hassle I manged to rotate a piece of text:
function OnGUI () {
var pos : Vector3 = new Vector3(100, 200, 0); //position for matrix
var quat : Quaternion = Quaternion.identity; //rotation for matrix
quat.eulerAngles = Vector3(0, 0, 90); //set the rotation to something - rotate around z!
GUI.matrix = Matrix4x4.TRS(pos, quat, Vector3.one); //Apply the matrix
GUI.Label(Rect(0, 0, 200, 20), "Some Text"); //notice how the rect starts at 0/0 and the matrix handles the position!
}
This is still not ideal since the text will be a bit blurry, but it’s better than nothing…
4 Comments
Nice work! I've reposted it on my blog (gave credit to you though). Let me know if you just want me to link.
~Hanford
http://hanfordlemoore.com/v/unity-rotating-gui-text
thanks for the link and the kind words! :)
Have you ever found a solution to this? I’ve run into the same problem now, and there aren’t any real answers out on the Googles.. :/
Yes. I’m using NGUI instead…
About col000r
Markus HoferIndie Game Developer
Austria, Europe
GAMES
NEW ORBITAge of Curling
Speedlap Red
RECENT POSTS
anyonemost peopleMERCH