daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Mar 24th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6.  
  7. public class CaptureScreenshot : MonoBehaviour {
  8.  
  9.     // Use this for initialization
  10.     void Start () {
  11.        
  12.     }
  13.    
  14.     // Update is called once per frame
  15.     void Update () {
  16.        
  17.     }
  18.  
  19.     public void snapPhoto()
  20.     {
  21.         StartCoroutine(TakeScreenshot());
  22.     }
  23.  
  24.     public IEnumerator TakeScreenshot()
  25.     {
  26.  
  27.         string imageName = "pothole.png";
  28.  
  29.         // Take the screenshot
  30.         ScreenCapture.CaptureScreenshot(imageName);
  31.  
  32.         //Wait for 4 frames
  33.         for (int i = 0; i < 5; i++)
  34.         {
  35.             yield return null;
  36.         }
  37.  
  38.         // Read the data from the file
  39.         //byte[] data = File.ReadAllBytes(Application.persistentDataPath + "/" + imageName);
  40.  
  41.  
  42.         //byte[] data = File.ReadAllBytes("C:/Users/boellis//Desktop//TheFuture//ARBusinessCard//SmartCityHack//pothole.png");
  43.         //Debug.Log(data);
  44.  
  45.  
  46.     }
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top