Version: 2017.1
public string deviceName ;

描述

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

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

注意:如果要使用 WebCamTexture 从通过 Unity Remote 连接的设备获取摄像机流,必须通过构造函数将其初始化。不能使用 WebCamTexture.deviceName 将设备从常规设备更改为远程设备,反之亦然。

// 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(); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961