Skip to content

Commit 4105ec8

Browse files
authored
Destroys texture after creating screenshot (#25)
1 parent d9dc4f0 commit 4105ec8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Runtime/BugSplat.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,12 @@ private byte[] CaptureInMemoryPngScreenshot()
424424
{
425425
try
426426
{
427-
// TODO BG the example calls Destory on texture, do we need to do that?
428427
var texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
429428
texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
430429
texture.Apply();
431-
return texture.EncodeToPNG();
430+
var result = texture.EncodeToPNG();
431+
GameObject.Destroy(texture);
432+
return result;
432433
}
433434
catch (Exception ex)
434435
{

0 commit comments

Comments
 (0)