Set this to specify the name of the device to use.
// Sets the device of the WebCamTexture to the first one available and starts playing it function Start () { var devices : WebCamDevice[] = WebCamTexture.devices; var webcamTexture : WebCamTexture = WebCamTexture(); if(devices.length > 0){ webcamTexture.deviceName = devices[0].name; webcamTexture.Play(); } }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void Start() { WebCamDevice[] devices = WebCamTexture.devices; WebCamTexture webcamTexture = new WebCamTexture(); if (devices.length > 0) { webcamTexture.deviceName = devices[0].name; webcamTexture.Play(); } } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def Start() as void: devices as (WebCamDevice) = WebCamTexture.devices webcamTexture as WebCamTexture = WebCamTexture() if devices.length > 0: webcamTexture.deviceName = devices[0].name webcamTexture.Play()