Fix capturing frames path

This commit is contained in:
nlitkowski 2021-12-19 23:27:08 +01:00
parent 4bddc2c518
commit 1ba0115904
14 changed files with 8 additions and 4 deletions

View File

@ -6,6 +6,10 @@ using UnityEngine;
#pragma warning disable IDE0090 // Use 'new(...)'
public class Main : MonoBehaviour
{
#region Constants
readonly string capturedFramesPath = Path.Combine(Application.dataPath, "..", "..", "capturedframe");
#endregion
#region Camera GUI fields
float m_FieldOfView = 60.0f;
float m_camPosX = 0.0f;
@ -137,8 +141,8 @@ public class Main : MonoBehaviour
}
}
bool exists = Directory.Exists(Application.dataPath + "/capturedframe");
if (!exists) Directory.CreateDirectory(Application.dataPath + "/capturedframe");
bool exists = Directory.Exists(capturedFramesPath);
if (!exists) Directory.CreateDirectory(capturedFramesPath);
//---------------------------------------------------------------------------------------------------------------------
@ -344,7 +348,7 @@ public class Main : MonoBehaviour
RenderTexture.active = currentRT;
++FrameCounter;
string path = Path.Combine(Application.dataPath, "..", "..", "capturedframe", "capturedframe" + "_" + tree1.name + "_" + FrameCounter.ToString() + ".png");
string path = Path.Combine(capturedFramesPath, "capturedframe" + "_" + tree1.name + "_" + FrameCounter.ToString() + ".png");
byte[] bytes = offscreenTexture.EncodeToPNG();
File.WriteAllBytes(path, bytes);
Debug.Log(path);

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
{"m_ExpandedPrefabGameObjectFileIDs":[],"m_ExpandedSceneGameObjectInstanceIDs":[],"m_ScrollY":0.0,"m_LastClickedFileID":0,"m_LastClickedInstanceID":0}
{"m_ExpandedPrefabGameObjectFileIDs":[],"m_ExpandedSceneGameObjectInstanceIDs":[-1178],"m_ScrollY":0.0,"m_LastClickedFileID":0,"m_LastClickedInstanceID":0}