Android High Polygon Count Issues

Hi everyone. I’m working on an Android drawing application using Unity 3.5.7 and I’m having performance issues.
Being that Unity is a 3D engine, I understand that the most straightforward way of doing 2D application/games is to use an Orthographic camera.

At the moment that’s what I’m using, combined with custom Plane objects (2 triangles each) to act as the drawing pixels.
The problem is that even drawing a rather small image, such as 512x512, results in a humongous triangle count (524288 triangles), which is far more than any Android device can take.

I know that using a 3D engine to make a 2D drawing app is rather dumb, but I have a commercial license for Unity and I would really like to put it to good use.

It’s not only the triangle count that slows it down. Looking at the stats, I can see that the Draw Calls increase by 1 for each “pixel” visible on the screen.

I’m interested in some alternatives to my method, that would have a lower performance impact. Even a plugin would be good if it’s free for commercial use (in my dreams :() or low cost.

Thanks.

Here’s a super-performance-friendly method you can use - manually create a single texture on a 2-triangle plane that the user draws to:

In code, create a Texture2D
Call SetPixel(x, y, color); on that Texture2D
Call Apply(); on that Texture2D to set all the pixels in place
Set the renderer.material.mainTexture of a GameObject to your Texture2D

Thx Dreamwriter, I will try it, even though I tried using SetPixel already, along with using Apply, and it was quite slow. Any texture above 512 by 512 was too slow to be feasible. Also, non-power-of-2 textures seemed to be slower.

AFAIK you cannot get good performance with Texture2D updates since Apply() is performance wise too expensive operation on mobile platforms.