Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using camera from an iOs or Android device

Discussion in 'Scripting' started by Khelgar, Mar 13, 2019.

  1. Khelgar

    Khelgar

    Joined:
    Mar 13, 2019
    Posts:
    16
    Hi everyone,

    I'm trying to access to a camera from a device (phone or tablet) but Unity never find them.
    I'm using this code to get camera devices :

    Code (csharp):
    1. WebCamDevice[] devices = WebCamTexture.devices;
    Unity only find laptop webcam or another USB webcam.

    Is there something to do on devices to using camera ?
    Or can you explain me please why it doesn't work ?
     
  2. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
  3. Khelgar

    Khelgar

    Joined:
    Mar 13, 2019
    Posts:
    16
    Yes it's what i did, but camera devices are never found with Unity. I just found laptop or usb webcam.
    For example, when a phone or iPad is connected to the laptop, my devices.Lenght always equals to 1 and the only device found is front laptop webcam.
     
  4. WheresMommy

    WheresMommy

    Joined:
    Oct 4, 2012
    Posts:
    890
    Well I don't think you can access the devices camera from your editor. Your first post appears to ask for the camera when playing on device, not in editor. Actually I am not sure you can use your phones camera that way without a workaround outside Unity
     
  5. jeff_griffith

    jeff_griffith

    Joined:
    Oct 31, 2021
    Posts:
    1