Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

SOLVED 'Cannot find webcam device UnityEngine.WebCamDevice' even though it can find the device...

Discussion in 'Scripting' started by ChosenWell, Sep 18, 2016.

  1. ChosenWell

    ChosenWell

    Joined:
    Mar 8, 2015
    Posts:
    23
    Solved! Needed to have just 'device.name' instead of device.name.ToString()


    I am using Windows 10 as both the target platform and the test platform.

    I am getting the following error:
    Cannot find webcam device UnityEngine.WebCamDevice

    Here is the code snippet I am using for testing. I can find the devices by name and display fine in the console (I have tried two so far: one integrated, and one USB)
    Code (CSharp):
    1.   WebCamDevice[] devices = WebCamTexture.devices;
    2.             for (int i = 0; i < devices.Length; i++) {
    3.                 Debug.Log(devices[i].name + " , " + i.ToString());
    4.             }
    5.             webCam = devices[1];
    6.             myWebCam = new WebCamTexture(webCam.ToString());
    7.             rend = GetComponent<Renderer>();
    8.             rend.material.mainTexture = myWebCam;
    9.             myWebCam.Play();
    I have found items on requesting permission and tried them with no luck as well. Although these are for "Web Player" access and this is not supported anymore.

    I have also downloaded the Window Store Tools for Unity and the Windows UWP. After this tried to test in editor but still no luck. (I also built this application but do not know how to test it).

    Does anyone know how I can access the web camera and have it play to a WebCamTexture()?
     
    Last edited: Sep 18, 2016
  2. shivu_98

    shivu_98

    Joined:
    Dec 13, 2016
    Posts:
    8
    Hey, how did you solve this issue ?