- Home /
gui text mirrored
Hi, there's a way for see the gui text mirrored?
i use this code for rotate text,but i can't mirror it..
private var rotAngle : float = 0;
private var pivotPoint : Vector2;
function OnGUI () {
pivotPoint = Vector2(Screen.width/2,Screen.height/2);
GUIUtility.RotateAroundPivot (rotAngle, pivotPoint);
if(GUI.Button(Rect(Screen.width/2-25, Screen.height/2-25, 50, 50),"Rotate"))
rotAngle += 10;
}
Answer by Wolfram · Jan 14, 2013 at 11:21 AM
Try GUIUtility.ScaleAroundPivot with -1 for x. If that doesn't work for negative values, you'll have to modify GUI.matrix directly.
Answer by leonida · Jan 16, 2013 at 09:59 AM
here's the code that i've used
var text="tryyyyyyy";
var w=200;
var h=200;
private var scale : Vector2 = Vector2(1,1);
private var pivotPoint : Vector2;
private var onetime = true;
function OnGUI () {
pivotPoint = Vector2(Screen.width/2,Screen.height/2);
GUIUtility.ScaleAroundPivot (scale, pivotPoint);
GUIUtility.RotateAroundPivot (rotAngle, pivotPoint);
GUI.Box(Rect(Screen.width/2, Screen.height/2, w, h),text);
if (onetime){scale += Vector2(0,-2);onetime=false;}
}
Hm, while this script might seem to do what you want, it is confusing and misleading, and way too complicated.
GUI.matrix is re-initialized every time OnGUI() gets called. So all this "onetime" stuff is useless and unnecessary if you simply initialize "scale" with (-1,1), as I have suggested in my answer. Also, remove the rotation completely, it is also unnecessary if you scale by (-1,1) ins$$anonymous$$d of (1,-1), as you currently do.
Your answer
Follow this Question
Related Questions
Move the text in a GUI Button/Box 1 Answer
GUI.label overlapping text 1 Answer
Gui Text Script 4 Answers
Alpha not working in GUITex 0 Answers
Intro GUI Text Script... 3 Answers