private IEnumerator GetImageCoroutine(OnCameraImage callback) { yield return(new WaitForEndOfFrame()); Texture2D texture = new Texture2D(_webcamTexture.width, _webcamTexture.height); texture.SetPixels(_webcamTexture.GetPixels()); texture.Apply(); if (callback != null) { callback.Invoke(texture); } }
public void GetImage(OnCameraImage callback) { StartCoroutine(GetImageCoroutine(callback)); }