Unity获取屏幕指定坐标的像素颜色
IEnumerator CaptureScreenshot()
{
//只在每一帧渲染完成后才读取屏幕信息
yield return new WaitForEndOfFrame();
Texture2D m_texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
// 读取Rect范围内的像素并存入纹理中
m_texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
// 实际应用纹理
m_texture.Apply();
Color color = m_texture.GetPixel((int)Input.mousePosition.x, (int)Input.mousePosition.y);
}