Screenshot not working

So in my program, the player can draw in an area, then click a button to save a picture of the drawing. However, the screenshots are taking, but they aren’t whats in the area there photographing. Also, in order for the picture to show up in the project, I have to go to another program and then back to Unity, although that could be because I’m getting the error ‘Read pixels was called to read pixels while inside the system frame buffer, while not inside the drawing frame’. One solution to this problem I read about is calling the screenshot in the void LateUpdate() but that doesn’t really work for me because I don’t want to take a picture every frame. Anyway, here’s my code.

public void CheckAnswer(){
		//Save Screenshot in the User Input folder
		index++;
		var width = 220;
		var height = 180;
		var startX = 0;
		var startY = 0;
		var tex = new Texture2D (width, height, TextureFormat.RGB24, false);

		tex.ReadPixels (new Rect (startX, startY, width, height), 0, 0);
		tex.Apply ();

		var bytes = tex.EncodeToPNG ();
		Destroy (tex);

		File.WriteAllBytes (imageLocation, bytes);
		Debug.Log ("Image Saved");
	}

Here are the pictures I get when I try to take a screenshot:
88707-savedscreen1.png
If I take a second picture its all yellow, and any after that are all white. Here’s what the actual screen looks like:

Try putting this in a Coroutine that waits for the end of the frame.

public void CheckAnswer()
{
         StartCoroutine (SnapShot ());
}
public IEnumerator SnapShot()
{
         //Save Screenshot in the User Input folder
         index++;
         var width = 220;
         var height = 180;
         var startX = 0;
         var startY = 0;
         var tex = new Texture2D (width, height, TextureFormat.RGB24, false);

         yield return new WaitForEndOfFrame ();
 
         tex.ReadPixels (new Rect (startX, startY, width, height), 0, 0);
         tex.Apply ();
 
         var bytes = tex.EncodeToPNG ();
         Destroy (tex);
 
         File.WriteAllBytes (imageLocation, bytes);
         Debug.Log ("Image Saved");
     }