Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. public RawImage rawimage;
  2.  
  3.  
  4. void Start () {
  5.  
  6. WebCamDevice backCameraDevice;
  7. Debug.Log("code started");
  8. WebCamDevice[] devices = WebCamTexture.devices;
  9. for (int i = 0; i < devices.Length; i++)
  10. Debug.Log(devices[i].name);
  11.  
  12. if (WebCamTexture.devices.Length == 0)
  13. {
  14. Debug.Log("No devices cameras found");
  15. return;
  16. }
  17.  
  18. backCameraDevice = WebCamTexture.devices[0];
  19. Debug.Log(backCameraDevice.name);
  20.  
  21. WebCamTexture webcamTexture = new WebCamTexture(backCameraDevice.name);
  22. webcamTexture.requestedWidth = 150;
  23. webcamTexture.requestedHeight = 150;
  24.  
  25. rawimage.texture = webcamTexture;
  26.  
  27. rawimage.material.mainTexture = webcamTexture;
  28. webcamTexture.Play();
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement