- Home /
Individually rotate GUI Elements?
How would I go about rotating an individual GUI Element separate to the rest of the GUI, meaning rotate one thing but not others, is this even possible?
Answer by Eric5h5 · Aug 16, 2010 at 02:48 PM
GUI functions can be rotated using GUI.matrix. GUIText and GUITexture elements can't be rotated. When using GUI.matrix in OnGUI, you should reset the matrix after the element you want rotated.
Answer by Alexej Grohe · Oct 18, 2010 at 06:26 PM
This is not right. You CAN rotate any GUI element individually. Its very simple, you rotate the whole GUI, draw your specific element and reverse the rotation. Look at this:
GUIUtility.RotateAroundPivot(clockNeedlRotation, Vector2(clockNeedlOffset.x, clockNeedlOffset.y+clockNeedl.height));
DrawImage(clockNeedlOffset, clockNeedl);
GUIUtility.RotateAroundPivot(-clockNeedlRotation, Vector2(clockNeedlOffset.x, clockNeedlOffset.y+clockNeedl.height));
Cheers,
Alexej
True only if the questioner is referring to UnityGUI. But that's not clear- there are also GUIText and GUITexture objects, which are not rendered by OnGUI. Eric's answer takes this into account (though he doesn't have code like you do.)
where did you find that script? or at least, what variables do you need to make, and what do they represent?
Or ins$$anonymous$$d of removing the clock rotation reset the matrix.
GUI.matrix = $$anonymous$$atrix4x4.identity;
Answer by Jean-Fabre · Jan 26, 2011 at 04:58 AM
Hi,
There is a working script in the following question:
http://answers.unity3d.com/questions/3561/how-to-rotate-gui-textures
Bye,
Jean
Answer by qJake · Aug 16, 2010 at 08:11 AM
UnityGUI elements (GUI.*
) cannot be rotated at all, as far as I know. And the older GUIElement items probably can't be, either, since (even if they have a Transform component), they still occupy screen-space. So to answer your question, no, it's not possible, at least not without some third party script.
Your answer
Follow this Question
Related Questions
Simple Menu(understanding GUI) 2 Answers
Resolution & aspect ratio GUI 1 Answer
Interface 3D 1 Answer
Detect GUI rotation degree 1 Answer
Rotate Texture2D around its center 3 Answers