Files
2026-02-21 16:45:37 +08:00

28 lines
766 B
C#

using System.Collections;
using LE_LevelEditor.Extensions;
using UnityEngine;
namespace SRDebugger.Internal
{
public class BugReportScreenshotUtil
{
public static byte[] ScreenshotData;
public static IEnumerator ScreenshotCaptureCo()
{
if (ScreenshotData != null)
{
Debug.LogWarning("[SRDebugger] Warning, overriding existing screenshot data.");
}
yield return new WaitForEndOfFrame();
Texture2D tex = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
tex.ReadPixels(new Rect(0f, 0f, Screen.width, Screen.height), 0, 0);
tex.Apply();
Texture2D tex2 = LE_FileSelectionHelpers.DownscaleTexture(tex, 800, 700);
ScreenshotData = tex2.EncodeToPNG();
Object.Destroy(tex);
Object.Destroy(tex2);
}
}
}