- Home /
Screenshot on windows phone increase memory why?
Hi all, I use my mobile camera from my application and sometimes I want to take a screenshot. To start camera I use WebCamTexture and a RawImage, all good and now I have a Texture2D where I read pixels and encode texture image to png, this will store that in a byte array.
Each time when I take a screenshot memory grows up but after encode I clear bytes array, I call GC.Collect(); GC.WaitForPendingFinalizers();
to free memory but no chance .
Does anyone have any ideea what can cause that? That happen in windows phone universal 10, I use unity 5.4
Thanks, any advice is appreciated :)
Answer by saschandroid · Oct 07, 2016 at 06:51 AM
A screenshot example in the scripting api uses
// Encode texture into PNG
byte[] bytes = tex.EncodeToPNG();
Object.Destroy(tex);
Probably destroying the texture helps to free memory.
Your answer
Follow this Question
Related Questions
How to save a RenderTexture to a png from a different camera? 1 Answer
How can I save the Bild from a Camera, which not main camera is. 1 Answer
Render Texture does not work on only IOS devices 0 Answers
Using 2 cameras on a mobile game: performance hit? 1 Answer
Profiler has HideFlags.DontSave Assets taking up 86mb [What is this?] 1 Answer