Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public RawImage rawimage;
- void Start () {
- WebCamDevice backCameraDevice;
- Debug.Log("code started");
- WebCamDevice[] devices = WebCamTexture.devices;
- for (int i = 0; i < devices.Length; i++)
- Debug.Log(devices[i].name);
- if (WebCamTexture.devices.Length == 0)
- {
- Debug.Log("No devices cameras found");
- return;
- }
- backCameraDevice = WebCamTexture.devices[0];
- Debug.Log(backCameraDevice.name);
- WebCamTexture webcamTexture = new WebCamTexture(backCameraDevice.name);
- webcamTexture.requestedWidth = 150;
- webcamTexture.requestedHeight = 150;
- rawimage.texture = webcamTexture;
- rawimage.material.mainTexture = webcamTexture;
- webcamTexture.Play();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement