BLACKISH DEV BLOG Support
 

 

Unity: Rotated GUI-Text

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…
Bookmark the permalink. Follow any comments here with the RSS feed for this post. Trackbacks are closed, but you can post a comment.

4 Comments

    Hanford on September 3, 2009 at 07:37 | Permalink

    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

    col000r on September 16, 2009 at 21:09 | Permalink

    thanks for the link and the kind words! :)

    Krummelz on May 8, 2013 at 08:46 | Permalink

    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.. :/

    col000r on October 22, 2014 at 11:07 | Permalink

    Yes. I’m using NGUI instead…

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>