using UnityEngine; using UnityEngine.UI; public class CameraManager : MonoBehaviour { public WebCamTexture webCamTexture; // Start is called before the first frame update void Start() { WebCamDevice[] devices = WebCamTexture.devices; webCamTexture = new WebCamTexture(devices[0].name); webCamTexture.Play(); } // Update is called once per frame void Update() { gameObject.GetComponent().texture = webCamTexture; gameObject.GetComponent().material.mainTexture = webCamTexture; } }