Search Unity

Unable to get webcam to work

Discussion in 'iOS and tvOS' started by Chien, Mar 29, 2012.

  1. Chien

    Chien

    Joined:
    May 1, 2009
    Posts:
    42
    Hi
    I use the 3.5's webcamtexture, but it works on my Mac, not on my iphone. Here is the code that I used:

    Code (csharp):
    1. var deviceName: String;
    2. var camWidth: int=160;
    3. var camHeight: int=120;
    4. var camFPS: int=12;
    5. var whichDevice: int=0;
    6.  
    7. function Start()
    8. {
    9.     var devices : WebCamDevice[] = WebCamTexture.devices;
    10.     deviceName = devices[whichDevice].name;
    11.     var webcamTexture : WebCamTexture = WebCamTexture(deviceName, camWidth, camHeight, camFPS);
    12.     renderer.material.mainTexture = webcamTexture;
    13.     webcamTexture.Play();
    14. }
    15.  
    Thanks for helping!
     
  2. loverainstm

    loverainstm

    Joined:
    Nov 16, 2012
    Posts:
    6
    the same issue,this bug also in unity4,what's a pity. this really pissed off