Make a GUI texture rotate around another?

I have three objects, each one has a GUI texture on it. The first is a large circle, the second is a point in the middle of that circle and the last is a pointer on the outside of that circle.

I want the outer pointer to rotate around the center point in the circle so the outer pointer follows the line of the large circle.

I’ve tried several things but can’t get it to work.

Cheers.

You should use GUIUtility.RotateAroundPivot. Read about this function on:

http://unity3d.com/support/documentation/ScriptReference/GUIUtility.RotateAroundPivot.html

I did something similar, and this is a simplified version of my script:

var bigCircle: Texture2D;
var rCircle: Rect;
var pointer: Texture2D;
var szPtr: Vector2;
var angle: float = 45;
    
function OnGUI(){

	var rPtr: Rect;
	var pivot: Vector2;

	// set the pivot at the circle center
	pivot.x = rCircle.x+rCircle.width/2;
	pivot.y = rCircle.y+rCircle.height/2;
	// set the pointer rect at the circle top
	rPtr.x = pivot.x-szPtr.x/2;
	rPtr.width = szPtr.x;
	rPtr.y = rCircle.y-szPtr.y/2;
	rPtr.height = szPtr.y;

	GUI.DrawTexture(rCircle,bigCircle);
	var svMat: Matrix4x4 = GUI.matrix;
	GUIUtility.RotateAroundPivot(angle%360,pivot); 
	GUI.DrawTexture(rPtr,pointer);
	GUI.matrix = svMat; 
}

Define the circle texture in bigCircle and the rect where it will be drawn in rCircle . Define also the pointer texture in pointer and its size in szPtr . The angle var rotates the pointer clockwise (in degrees).