SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
961 B

4 years ago
  1. //this script is used in the demo.
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. using System.Collections;
  5. using System;
  6. using System.IO;
  7. public class Capture_Example : MonoBehaviour {
  8. //the output UI Image
  9. public Image Output;
  10. //the output UI Image
  11. public Image Output2;
  12. //the location of the green cube to be stored
  13. private Vector3 CubesPos;
  14. public void Press()
  15. {
  16. //take a screenshot
  17. Capture.TakeScreenShot();
  18. //record the location of the cube
  19. CubesPos = GameObject.Find("Cube (1)").gameObject.transform.position;
  20. //you need to wait a small amount of time for the screenshot to be saved
  21. Invoke("Get",0.5f);
  22. }
  23. public void Get()
  24. {
  25. //get the screenshot as a sprite
  26. Output.sprite = Capture.GetScreenShot_Sprite();
  27. //get the corped screenshot as a sprite
  28. Output2.sprite = Capture.GetScreenShot_Sprite(CubesPos,100);
  29. }
  30. }