Beispiel #1
0
    public async void CapturePhoto()
    {
        // Only `CameraDevice` supports capturing photos, not `ICameraDevice`
        // if (query.currentDevice is CameraDevice device) {
        //     // Capture photo
        photoTexture = await device.CapturePhoto();

        Debug.Log($"Captured photo with resolution {photoTexture.width}x{photoTexture.height}");
        // Display photo texture for a few seconds
        photoPanel.gameObject.SetActive(true);
        photoPanel.texture            = photoTexture;
        photoAspectFitter.aspectRatio = photoTexture.width / (float)photoTexture.height;
        // }
    }
Beispiel #2
0
    // Update is called once per frame
    async void Update()
    {
        timer += Time.deltaTime;
        if (timer > interval)
        {
            timer = 0.0f;
            var capturePhoto = await rearDevice.CapturePhoto();

            BGImage.texture = capturePhoto;
            var previewTexture = await frontDevice.CapturePhoto();

            CaptureImgage.texture = previewTexture;
        }
    }