mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-29 04:53:06 +00:00
f14d2a423f
* Super Retro VFX! * Updated Screen Jump default * also airboarder works now --------- Co-authored-by: minenice55 <star.elementa@gmail.com>
23 lines
720 B
C#
23 lines
720 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ScreenCaptureManager : MonoBehaviour
|
|
{
|
|
public Texture2D CaptureScreen()
|
|
{
|
|
RenderTexture rt = new RenderTexture(Screen.width, Screen.height, 24);
|
|
Camera.main.targetTexture = rt;
|
|
Camera.main.Render();
|
|
Camera.main.targetTexture = null;
|
|
Texture2D screenShot = new Texture2D(Screen.width, Screen.height,
|
|
TextureFormat.RGB24, false);
|
|
RenderTexture.active = rt;
|
|
screenShot.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
|
|
screenShot.Apply();
|
|
RenderTexture.active = null;
|
|
Destroy(rt);
|
|
return screenShot;
|
|
}
|
|
}
|
|
|