unitycoder / UnityMobilePaint

Public repository for MobilePaint issues & requests
https://www.assetstore.unity3d.com/en/#!/content/19803?aid=1101lGti
MIT License
51 stars 16 forks source link

Out of memory in android, after many calls to InitializeEverything #19

Closed unitycoder closed 8 years ago

unitycoder commented 8 years ago

http://forum.unity3d.com/threads/released-mobile-paint-with-multi-touch.262645/page-4#post-2513834

unitycoder commented 8 years ago

texture amount gets increased each initialize call.. coming from this line: drawingTexture = new Texture2D(texWidth, texHeight, TextureFormat.RGBA32, false);

unitycoder commented 8 years ago

temporary fix: // FIND LINE drawingTexture = new Texture2D(texWidth, texHeight, TextureFormat.RGBA32, false);

// CHANGE TO

if (drawingTexture==null)
{
    drawingTexture = new Texture2D(texWidth, texHeight, TextureFormat.RGBA32, false);
}
unitycoder commented 8 years ago

better fix, because the previous one wouldnt re-initialize it to new size etc.

// FIND LINE drawingTexture = new Texture2D(texWidth, texHeight, TextureFormat.RGBA32, false);

// CHANGE TO

if (drawingTexture != null) Texture2D.DestroyImmediate(drawingTexture , true);
drawingTexture = new Texture2D(texWidth, texHeight, TextureFormat.RGBA32, false);

thanks to theLaymaster: http://forum.unity3d.com/threads/released-mobile-paint-with-multi-touch.262645/page-4#post-2518199

unitycoder commented 8 years ago

fixed in the coming v1.96 update