WebCamTexture webcamTexture = new WebCamTexture();
//如果有后置摄像头,调用后置摄像头
for (int i = 0; i < WebCamTexture.devices.Length; i++)
{
if (!WebCamTexture.devices[i].isFrontFacing)
{
webcamTexture.deviceName = WebCamTexture.devices[i].name;
break;
}
}
Renderer renderer = GetComponent<Renderer>();
renderer.material.mainTexture = webcamTexture;
webcamTexture.Play();
unity 调用摄像头
最新推荐文章于 2024-06-23 09:00:00 发布