title: Read pixel color at screen point (Efficiently)
body: <p>I'm need to read pixel color in C# Unity3D at screen point.</p>
  
  <p>I'm using Render Texture and ReadPixels method. 
  Using it every 0.5f second is bad for performance (even if my Render texture size is 128x128px) and I'm trying to find another way to get this data faster.
  I read somewhere that it is possible to use directly <code>glReadPixels</code> but I have no idea how to use it?</p>
  
  <p>I need to detect if in this place (point on screen) is something or not.</p>
  
  <p>This is code that I have at this moment.</p>
  
  <pre><code>using UnityEngine;
  using System;
  using System.Collections;
  
  public class ColController : MonoBehaviour
  {
      public Camera collCamera;
      public Texture2D tex2d;
  
  
      void Start()
      {
          collCamera = GetComponent&lt;Camera&gt;();
          tex2d = new Texture2D(collCamera.targetTexture.width, collCamera.targetTexture.height, TextureFormat.ARGB32, false);
  
          RenderTexture.active = collCamera.targetTexture;
          StartCoroutine (Execute ());
  
      }
  
      IEnumerator Execute()
      {
          while (true) {
  
                  yield return new WaitForEndOfFrame ();
                  tex2d = GetRTPixels (collCamera.targetTexture);
                  yield return new WaitForSeconds (0.5f);
  
          }
      }
  
  
      static public Texture2D GetRTPixels(RenderTexture rt)
      {
          RenderTexture currentActiveRT = RenderTexture.active;
  
          RenderTexture.active = rt;
  
          // Create a new Texture2D and read the RenderTexture image into it
          Texture2D tex = new Texture2D(rt.width, rt.height);
          tex.ReadPixels(new Rect(0, 0, tex.width, tex.height), 0, 0);
  
          RenderTexture.active = currentActiveRT;
          return tex;
      }
  
      void Update() {
          screenPos = collCamera.WorldToScreenPoint (player.transform.position);
          positionColor = tex2d.GetPixel ((int)screenPos.x, (int)screenPos.y);
  
      }
  
  
  }
  </code></pre>