Gui rotation?

Hello world! :slight_smile:

Can someone say how to rotate guiTexture component?, not GUI.DrawTexture.

Thanks in advance for help

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.

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