title: How to take & save picture / screenshot using Unity ARCore SDK?
body: <p>I found the answer to how to do it natively here but Im running Unity.</p>
  
  <p><a href="https://stackoverflow.com/questions/48191513/how-to-take-picture-with-camera-using-arcore">How to take picture with camera using ARCore</a></p>
  
  <p>I'm not sure how to access the Unity surface renderer thread to be able to drop in those functions.</p>
  
  <p><a href="https://github.com/iBicha/WebRTC-for-Unity/blob/2d81fc2ac3939674cabce37c1976122aaf42fb1d/webrtc-android/webrtc/src/main/java/com/ibicha/webrtc/UnityEGLUtils.java" rel="nofollow noreferrer">This looks</a> like a good start. Ideas?</p>
  
  <p>Edit:</p>
  
  <p>Using Texture2d ReadPixels or ScreenCapture.CaptureScrenshot are not viable as they are blocking the render thread. The code below is enough to block the thread.</p>
  
  <pre><code>StartCoroutine(TakeScreenshot());
  
  private IEnumerator TakeScreenshot()
      {
          yield return new WaitForEndOfFrame();
  
          Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
          ss.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
          ss.Apply();
  </code></pre>
  
  <p>Edit 2: <a href="https://medium.com/google-developers/real-time-image-capture-in-unity-458de1364a4c" rel="nofollow noreferrer">Am considering using this technique</a>. Will report back if successful.</p>