How to make a pixel painting program using Unity

So I’m making an Android app/game using Unity where the user is able to “draw” by touching the screen. The drawings will be pixel art – basically, a pixel art drawing function – so everything should be pixel perfect.
Some functions I will add are: OlansiChina.com

  • Changing brush size
  • Changing brush color
  • Filling areas
  • Erasing

A game called Worldbox has a pretty similar function, where users are able to draw “land.”

I thought about using the tilemap function of Unity, and even made a program that does all #1~#4 well. However, if the tilemap(drawing size) exceeds 100*100 tiles, the app took forever to load, and I concluded that tilemaps weren’t suited for drawing programs.

A friend of mine said that I would have to make some kind of “editor” for this application, and Unity just isn’t fit for that.

However, I only know how to make applications using Unity, so are there any Unity functions I can use to make this app?

The answer could be very simple(ex. Just use the tilemap function). It doesn’t have to explain how I could make this app, but what I could use.

can create texture, then draw on it with

this can be already good enough, for low resolution texture,
but if its big high resolution texture, then it starts to get slower, need to look into,

or go another way, and use render textures, something like

asset store has ready drawing and painting solutions also.

i have one old drawing asset here, but its quite a mess (can take some drawing parts from it if needed though)

You absolutely can make a graphi editor in unity. There are several ways you could go about it:

Store pixel data in memory, and use Texture2D.LoadRawTextureData ( https://docs.unity3d.com/ScriptReference/Texture2D.LoadRawTextureData.html )

Use render targets. Basically when you paint with a brush, what you’re doing is taking one texture, blitting it onto another and then painting a brush on top. Or just painting a brush onto it.

Use shaders or compute shaders. Some shader/computer shader versions allow random memory access, meaning you could implement brush operations as shaders and use them ( http://blog.deferredreality.com/write-to-custom-data-buffers-from-shaders/ ), This is likely not suitable for mobile and works better for desktop.

So, your friend is mistaken. You can make a graphic editor in unity. Now, if you were trying to make a word processor, then unity likely wouldn’t be the best choice.

3 Likes