using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cameraView : MonoBehaviour
{
public GameObject cameraViewPlan;
public static Texture2D viewTexture;
public static WebCamTexture viewTextureCamera;
// Use this for initialization
void Start()
{
WebCamDevice[] devices = WebCamTexture.devices;
viewTextureCamera = new WebCamTexture("Logitech HD Webcam C310", 640, 480, 30);//更改相机名称
viewTextureCamera.Play();
}
// Update is called once per frame
void Update()
{
viewTexture = new Texture2D(viewTextureCamera.width, viewTextureCamera.height);
viewTexture.SetPixels(viewTextureCamera.GetPixels());
viewTexture.Apply();
GetComponent<Renderer>().material.mainTexture = viewTexture;
}
}
打开相机
最新推荐文章于 2018-09-30 17:10:38 发布