using System.Threading.Tasks;
public class RecordWebCam : MonoBehaviour {
var cameraTexture = new WebCamTexture();
// Wait for user to smile :)
var recorder = new GIFRecorder(
cameraTexture.width, // image width
cameraTexture.height, // image height
0.1f // frame duration in seconds
for (var i = 0; i < 20; i++) {
recorder.CommitFrame(cameraTexture.GetPixels32());
// Wait a bit before next commit
var path = await recorder.FinishWriting();