- Home /
Select webcam not by name,select webcam by unique id on PC
I know that the webcam can be selected by name like this:
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
void Start()
{
WebCamDevice[] devices = WebCamTexture.devices;
WebCamTexture webcamTexture = new WebCamTexture();
if (devices.Length > 0)
{
webcamTexture.deviceName = devices[0].name;
webcamTexture.Play();
}
}
}
The problem arises when there are two webcams with the same name in the system. How can I select the other webcam in such case? Perhaps by hardware ID somehow...? , I know that the webcam can be selected by name like this:
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
void Start()
{
WebCamDevice[] devices = WebCamTexture.devices;
WebCamTexture webcamTexture = new WebCamTexture();
if (devices.Length > 0)
{
webcamTexture.deviceName = devices[0].name;
webcamTexture.Play();
}
}
}
The problem arises when there are two webcams with the same name in the system. How can I select the other webcam in such case? Perhaps somehow by hardware ID...?
Comment
Your answer
Follow this Question
Related Questions
Empty game objects - too much? 3 Answers
Unity3D and Dual GPU 0 Answers
Does Mathf.PerlinNoise() always return the same output? 1 Answer
Fixed frame rate 3 Answers