Import Unity Project

This commit is contained in:
2023-05-25 09:55:34 +02:00
parent 1dfae877ee
commit df6dc972ae
34 changed files with 2969 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RenderManager : MonoBehaviour
{
public RenderTexture outTexture;
public string outPath;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if(Time.frameCount > 10) {
SaveRenderTexture(outTexture, outPath + Time.frameCount + "-" + Time.realtimeSinceStartup + ".png");
}
if(Time.frameCount > 20) {
Debug.Log("QUIT");
Application.Quit();
}
}
static void SaveRenderTexture(RenderTexture rt, string path)
{
RenderTexture.active = rt;
Texture2D tex = new Texture2D(rt.width, rt.height, TextureFormat.RGB24, false);
tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);
RenderTexture.active = null;
var bytes = tex.EncodeToPNG();
System.IO.File.WriteAllBytes(path, bytes);
Debug.Log($"Saved texture: {rt.width}x{rt.height} - " + path);
}
}

View File

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