23 lines
579 B
C#
23 lines
579 B
C#
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<RawImage>().texture = webCamTexture;
|
|
gameObject.GetComponent<RawImage>().material.mainTexture = webCamTexture;
|
|
}
|
|
}
|