public string deviceName ;

Description

设置此属性可指定要使用的设备的名称。

只有在摄像机不运行时,设置此属性才有效。

Note: if you want to use WebCamTexture to get the camera stream from device connected through Unity Remote, then you must initalize it through the constructor. It's not possible to change device using WebCamTexture.deviceName from regular devices to remote devices and vice versa.

// Sets the device of the WebCamTexture to the first one available and starts playing it
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { WebCamDevice[] devices = WebCamTexture.devices; WebCamTexture webcamTexture = new WebCamTexture();

if (devices.Length > 0) { webcamTexture.deviceName = devices[0].name; webcamTexture.Play(); } } }