1using System.Collections;
2using System.Collections.Generic;
3using System.Runtime.InteropServices;
10 [DllImport(
"__Internal")]
11 private static extern void DownloadFile(
byte[] array,
int byteLength,
string fileName);
13 private int screenshotCounter = 0;
17 var cam = Camera.main;
21 if (o.GetComponent<Canvas>())
23 o.GetComponent<Canvas>().enabled =
false;
34 if (o.GetComponent<Canvas>())
36 o.GetComponent<Canvas>().enabled =
true;
47 StartCoroutine(
NetworkManager.
instance.UploadScreenshotCourse(picBytes, () => { PopupManager.instance.ShowPopup(
"SUCCESS",
"UPLOAD_SUCCESS"); }, () => { PopupManager.instance.ShowPopup(
"UPLOAD_ERROR",
"UPLOAD_ERROR_TEXT"); }));
54 var renderTexture =
new RenderTexture(width, height, 24);
55 camera.targetTexture = renderTexture;
57 RenderTexture.active = renderTexture;
60 var screenShot =
new Texture2D(width, height, TextureFormat.RGB24,
false);
61 screenShot.ReadPixels(
new Rect(0, 0, width, height), 0, 0);
64 camera.targetTexture =
null;
65 RenderTexture.active =
null;
68 DestroyImmediate(renderTexture);
70 Destroy(renderTexture);
73 return screenShot.EncodeToPNG();
static byte[] TakeScreenShot(int width, int height, Camera camera)
GameObject[] HideInScreenshots