public Texture2D texture2D = null;
void Awake()
{
texture2D = GetComponent<UITexture>().mainTexture as Texture2D;
}
void OnClick()
{
Vector3 textureWheelPos = UICamera.currentCamera.WorldToScreenPoint(transform.position);
Vector2 pos
= new Vector2
(textureWheelPos
.x, textureWheelPos
.y);
pos = UICamera.lastTouchPosition - pos;
int x = (int)pos.x;
int y = (int)pos.y;
Color color = texture2D.GetPixel(x, y);
Debug.Log("X: " + x + "; Y: " + y + "; Red: " + color.r + "Green: " + color.g + "Blue: " + color.b + "Alpha: " + color.a);
}