Fix frame capturing path
This commit is contained in:
parent
4a6bdf0e96
commit
7cea4cd4e8
@ -7,7 +7,7 @@ using UnityEngine;
|
|||||||
public class Main : MonoBehaviour
|
public class Main : MonoBehaviour
|
||||||
{
|
{
|
||||||
#region Constants
|
#region Constants
|
||||||
readonly string capturedFramesPath = Path.Combine(Application.dataPath, "..", "..", "capturedframe");
|
string capturedFramesPath = Path.Combine(Application.dataPath, "..", "..", "Trees");
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Camera GUI fields
|
#region Camera GUI fields
|
||||||
@ -141,6 +141,8 @@ public class Main : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
capturedFramesPath = Path.Combine(capturedFramesPath, tree1.name);
|
||||||
|
|
||||||
bool exists = Directory.Exists(capturedFramesPath);
|
bool exists = Directory.Exists(capturedFramesPath);
|
||||||
if (!exists) Directory.CreateDirectory(capturedFramesPath);
|
if (!exists) Directory.CreateDirectory(capturedFramesPath);
|
||||||
|
|
||||||
@ -348,7 +350,7 @@ public class Main : MonoBehaviour
|
|||||||
RenderTexture.active = currentRT;
|
RenderTexture.active = currentRT;
|
||||||
++FrameCounter;
|
++FrameCounter;
|
||||||
|
|
||||||
string path = Path.Combine(capturedFramesPath, tree1.name + "-" + FrameCounter.ToString() + ".png");
|
string path = Path.Combine(capturedFramesPath, FrameCounter.ToString() + ".png");
|
||||||
byte[] bytes = offscreenTexture.EncodeToPNG();
|
byte[] bytes = offscreenTexture.EncodeToPNG();
|
||||||
File.WriteAllBytes(path, bytes);
|
File.WriteAllBytes(path, bytes);
|
||||||
Debug.Log(path);
|
Debug.Log(path);
|
||||||
|
Loading…
Reference in New Issue
Block a user