纳金网

标题: 【脚本资源】Unity 3d 调用手机摄像头 [打印本页]

作者: lp5131427    时间: 2013-5-29 17:17
标题: 【脚本资源】Unity 3d 调用手机摄像头
本帖最后由 艾西格亚 于 2013-5-30 01:34 编辑

public  WebCamTexture   webCamTexture;
public   Material     webCamMaterial;
IEnumerator   webCam(){
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
    if (Application.HasUserAuthorization(UserAuthorization.WebCam))  
    {  
        WebCamDevice[] devices = WebCamTexture.devices;  
        deviceName = devices[0].name;  

    tex= new WebCamTexture(deviceName, 400, 300, 12);  
    webCamShow.mainTexture=tex;
        tex.Play();
    }  
}


核心知识:
WebCamTexture(网络摄像头材质)
关键方法:
WebCamTexture.Play()播放;WebCamTexture.Pause()暂停;WebCamTexture.Stop()停止;
例1:


作者: may    时间: 2013-5-31 04:46
果断的先收藏下来!
作者: aaabbbsss12345    时间: 2013-6-27 16:43
好东西,好东西
作者: 蜗牛    时间: 2013-6-28 15:31
果断的先收藏下来!

作者: xxj123    时间: 2013-9-13 10:02
不错的资源,谢谢分享




欢迎光临 纳金网 (http://c-www.narkii.com/club/) Powered by Discuz! X2.5