What I’m trying to do is rotate 2 parts of crosshair in different angle direction
void DrawCrossHair()
{
Matrix4x4 matrixBackup = GUI.matrix;
Vector2 pivot = new Vector2 (Screen.width/2, Screen.height/2);
angle += 100*Time.deltaTime;
position = new Rect((Screen.width / 2) - 40, (Screen.height/2)-40, 80, 80);
if (Input.GetButton("Fire2"))
{
GUIUtility.RotateAroundPivot(angle,pivot);
GUI.DrawTexture (position, zCrosshair1);
GUIUtility.RotateAroundPivot(-angle,pivot);
GUI.DrawTexture (position, zCrosshair2);
}
GUI.matrix = matrixBackup;
}
But the second crosshair part wont rotate at all.
try another variable with a new angle im not sure if your -angle works or not it just looks somehow suspect.
same problem, already tried…
Hey,
I’ve found this script some time ago, dunno from where I get it, but you can use it to rotate GUITextures, just assign the script to your GUITexture and setup the values to your needs. You can attach it to multiple GUITextures as well. Should do the trick 
using UnityEngine;
[ExecuteInEditMode()]
public class rotateGUITexture : MonoBehaviour
{
public Texture2D texture = null;
public float angle = 0;
public Vector2 size = new Vector2(128, 128);
Vector2 pos = new Vector2(0, 0);
Rect rect;
Vector2 pivot;
void Start()
{
UpdateSettings();
}
void UpdateSettings()
{
pos = new Vector2(transform.localPosition.x, transform.localPosition.y);
rect = new Rect(pos.x - size.x * 0.5f, pos.y - size.y * 0.5f, size.x, size.y);
pivot = new Vector2(rect.xMin + rect.width * 0.5f, rect.yMin + rect.height * 0.5f);
}
void OnGUI()
{
if (Application.isEditor) { UpdateSettings(); }
Matrix4x4 matrixBackup = GUI.matrix;
GUIUtility.RotateAroundPivot(angle, pivot);
GUI.DrawTexture(rect, texture);
GUI.matrix = matrixBackup;
}
}
dont you need to rotate by 2*angle for the second?
start at zero degrees, rotate by 30 to 30, then rotate by -30, to be back at zero again