WebCamTexture ERROR - Could not find specified video device

I’m just trying to setup a simple script so that it uses the native webcam installed on my laptop and display it on a RawImage in Unity 2017.3.1f1

Webcam: USB2.0 HD UVC WebCam

I’ve been finding a solution for hours but I kept getting unanswered questions or incomplete comments with Vuforia or DirectShow which I do not need.

I pasted code from Unity Docs directly and followed directions of Unity Videos word for word but I always get the same error:

ERROR - Could not find specified video device
UnityEngine.WebCamTexture:Play()

The webcam is listed on Unity’s detected devices and can Log the device string properly but it always fails on WebCamTexture.Play();

the only thing that comes into mind right now is that the webcam is unsupported and I have to try a different one.


sample code copied and pasted:

        WebCamDevice[] devices = WebCamTexture.devices;
        Debug.Log("Number of web cams connected: " + devices.Length);
        Renderer rend = this.GetComponentInChildren<Renderer>();

        WebCamTexture mycam = new WebCamTexture();
        string camName = devices[0].name;
        Debug.Log("The webcam name is " + camName);
        mycam.deviceName = camName;
        rend.material.mainTexture = mycam;

        mycam.Play();

Additional Info:
If I restart Unity and run it the very first time, the WebCam light turns on for a second, shuts off, then I get the error.


Edit:
Testing using my android phone as a webcam works. So I assume it would have something to do with the camera itself (I have no idea how the software handles different cameras) or the native webcam name’s special chars ‘2.0’. I tried changing the name via registry to ‘USB2 HD UVC WebCam’ but the string Unity outputs still keeps the 2.0, so I’m not sure how to fully change it.

Edit: After restarting the PC the value didn’t change so I would assume Unity uses the bus description instead of the actual name. If you guys have any ideas to test this please feel free to shout out.

Edit: So I’m not sure if this is the right cause but perhaps the camera is run through DirectShow(?) which is unsupported by Unity(?) so I might just have to choose webcams that dont use it.

I had this exact problem. You mentioned DirectShow, so I assume you are running Windows. Solution for me was to go into Windows Settings/Privacy/Camera and set “Allow apps to access your camera” to “on.” Worked right away after that.

It doesn’t show option of Unity in settings.