more screenshit and fix sunset box grabbing

This commit is contained in:
Crispy 2023-02-12 22:21:03 +01:00
parent 9e0b3a400b
commit 8f9dd2d571
11 changed files with 197 additions and 87 deletions

View file

@ -0,0 +1,3 @@
{
"name": "NewAssembly"
}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b04131ef45270a5c495fcdf846f0804a
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

32
Assets/fuck/Screenshot.cs Normal file
View file

@ -0,0 +1,32 @@
using System.IO;
using UnityEngine;
public class Screenshot : MonoBehaviour
{
public bool takeScreenshot;
public string filename = "unity_screenshot.png";
void Start()
{
if (takeScreenshot)
{
Camera cam = GetComponent<Camera>();
RenderTexture currentRT = RenderTexture.active;
RenderTexture.active = cam.targetTexture;
cam.Render();
Texture2D Image = new Texture2D(cam.targetTexture.width, cam.targetTexture.height);
Image.ReadPixels(new Rect(0, 0, cam.targetTexture.width, cam.targetTexture.height), 0, 0);
Image.Apply();
RenderTexture.active = currentRT;
var Bytes = Image.EncodeToPNG();
Destroy(Image);
File.WriteAllBytes("/home/crispypin/pictures/" + filename, Bytes);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4733ef1d4170fa3b383a26e80d5538e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: