功能很实用,代码很简单,这里就不多废话了。
webcamtexture:网络摄像头材质 webcamtexture.play() 播放; webcamtexture.pause() 暂停; webcamtexture.stop() 停止; //经测试此代码可以使用,当你绑定到游戏物体时尽可以了、 using unityengine; using system.collections; public class test : monobehaviour { public string devicename;//这个虽然public,但无需为其绑定变量,直接运行,默认调用,显示本地摄像机的名称 webcamtexture webcam; // use this for initialization void start () { webcamdevice[] devices = webcamtexture.devices; devicename = devices[0].name; webcam = new webcamtexture(devicename, 400, 300, 12); renderer.material.maintexture = webcam; webcam.play(); } // update is called once per frame void update () { } }
以上所述就是本文的全部内容了,希望大家能够喜欢。
如对本文有疑问, 点击进行留言回复!!
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
网友评论