small fixes & cleanup

This commit is contained in:
Crispy 2023-02-14 20:04:51 +01:00
parent 882f70be0b
commit 694dab564d
5 changed files with 60 additions and 52 deletions

View file

@ -6,12 +6,16 @@ public class Screenshot : MonoBehaviour
public bool takeScreenshot;
public string filename = "unity_screenshot.png";
public RenderTexture textureReference;
void Start()
{
if (takeScreenshot)
{
Camera cam = GetComponent<Camera>();
cam.targetTexture = textureReference;
RenderTexture currentRT = RenderTexture.active;
RenderTexture.active = cam.targetTexture;