I’m currently experiencing an issue attempting to support multiple webcams.
When I call WebCamTexture.devices I get a list of 2 devices (one for each webcam I have plugged in) but one of the names is blank (as in, string.Empty).
This causes an issue because when I create a new WebCamTexture with a blank name it doesn’t seem to grab the webcam that Unity thinks has no name, and instead fails (it might be attempting to grab the other webcam which is already in use).
This is not a problem if I only have one webcam plugged in (even if it’s the one with the blank name) in this case, creating the WebCamTexture with a blank name is successful and starts recording from the camera.
Has anyone else encountered this? I’m not sure why Unity thinks the camera has no name, Windows/Device Manager think it has one!
@Pyroka I have the same problem. I believe this happens when the full name of the device has a special character in it. The device page on windows only shows the short name.
Example:
devices show Kinect.
full name is Kinect Microsoft(r).
the (r) is actually the copyright symbol which is unknown to the compiler and thuss shows an empty string.
The problem is, that you cannot replace the symbols to somethign that is readable, because when you do that you first have to load the name in a string, which will be empty. I’ve had to problem for a long time and I try to work around it. The best thing is to just use a webcam that has a valid name.
Trust webcams dont have special symbols and are usable by device name. So you might want to avoid every microsoft webcam at all costs.
Please let me know if you found another way around this problem. I will ofcourse also update you when I found a better solution.
I tried that with wait for a Second, but still no luck to get names, Top of that only front cam is accessible (which has name “1”). Rear cam has no name and doesn’t even accessible.
@Pyroka
I’m experiencing the same problem. The webcam is a new Microsoft LifeCam HD-3000 I bought just for Unity (didn’t know about this problem :/) and it’s the only camera connected to the PC. The “camera” app in Win 10 shows the image just fine but Unity won’t get a name.
I can’t use the above code (using C# 6), so I just created a button that sets the “devices” array and then check the name in “Update” (“if(devices!=null)”) but there’s no name, even after a couple of seconds.