using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TestCopyTexture : MonoBehaviour
{
    [SerializeField] private RawImage sourceImage;
    private WebCamTexture webCamTexture;

    // Start is called before the first frame update
    void Start()
    {
        InitWebCamTexture();
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    private void InitWebCamTexture()
    {
        WebCamDevice myDevice = new WebCamDevice();
        myDevice = WebCamTexture.devices[0];
        webCamTexture = new WebCamTexture(myDevice.name);
        sourceImage.texture = webCamTexture;
        webCamTexture.Play();
    }
}
