Unity调用手机摄像头进行摄像,并显示
核心知识:
WebCamTexture(网络摄像头材质)
关键方法:
WebCamTexture.Play()播放;WebCamTexture.Pause()暂停;WebCamTexture.Stop()停止;
例1:
publicWebCamTexture webCamTexture;
public Material webCamMaterial;
IEnumerator webCam(){
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
if (Application.HasUserAuthorization(UserAuthorization.WebCam))
{
WebCamDevice[] devices = WebCamTexture.devices;
deviceName = devices.name;
tex= new WebCamTexture(deviceName, 400, 300, 12);
webCamShow.mainTexture=tex;
tex.Play();
}
}
学习~~学习~~学习~~
感谢楼主的无私分享! 顶顶多好 真心顶 说的非常好 很好哦 不错不错 很不错 楼主是超人