unityでwebカメラを使ってアプリケーションを開発しています。
webカメラを2つ使っているのですが、時々どちらか片方のwebカメラが反応しなくなります。(ランプがつかない、または点滅)
unityのバージョンは5.5.0 OSはWindows8.1 です。 使用webカメラはLogicool HD C270、310です。
コード以下の通りです。
using UnityEngine;
using System.Collections;
public class WebCam : MonoBehaviour {
public int cameraNumber = 0; private WebCamTexture webcamTexture; void Start () { WebCamDevice[] devices = WebCamTexture.devices; if (devices.Length > cameraNumber) { webcamTexture = new WebCamTexture(devices[cameraNumber].name, 1080, 720, 30); GetComponent<Renderer> ().material.mainTexture = webcamTexture; webcamTexture.Play(); } else { Debug.Log("no camera"); } }
}
あなたの回答
tips
プレビュー