- Home /
Gui rotation?
Hello world! :)
Can someone say how to rotate guiTexture component?, not GUI.DrawTexture.
Thanks in advance for help
Answer by dannyskim · Feb 25, 2012 at 08:12 PM
You cannot directly rotate a guiTexture component. Unity does not include any functions to enable this ability as well. You can't rotate the gameObject or transform associated with it either, so believe me, drop what your'e doing and look for a different way.
Your best bet is to use a different method to get your intended effect, such as a plane that is an actual in game game object that has a transformation that you can rotate easily.
Answer by dentedpixel · May 04, 2013 at 12:19 PM
It is in fact possible (at least it is now, maybe it wasn't at the time of this post). You can do so by manipulating the GUI.matrix.
I have added some handy animation helpers to my animation engine LeanTween, that allow you to animate such elements like:
var textRect3:LTRect = new LTRect(0.0, 0.0, 200, 300 );
function OnGUI(){
if(GUI.Button(new LTRect(0.0, 0.0, 200, 300 ), "Rotate")){
LeanTween.rotate( textRect3, 150.0, 1.0, ["ease",LeanTween.easeOutElastic]);
}
GUI.DrawTexture( textRect3.rect, textureToAnimate);
GUI.matrix = Matrix4x4.identity; // Reset to normal rotation
}
I am having quite a bit of trouble with this particular topic... could you please give me a hand? Thank you! LIN$$anonymous$$