- Home /
Generate a new sprite from painting
I'm interested in making a 2d pixel art skin editor, but i'm clueless in how to do it. The idea I had is to create a paint program in the game, read each pixel color with an array, create a 2d texture and export it into an sprite as a png. I'm not yet confident enough with C# and getting some ideas or resources would be a huge help, thanks!
Answer by TomArano_Dimenco · Aug 17, 2020 at 09:10 AM
the paint part is the hard part i think, there exist assets that u can buy (like https://assetstore.unity.com/packages/tools/painting/upainter-162653#reviews)
If you want to do this yourself, my best guess would be to use a render texture displayed either in 3d space or directly on screen depth, log screen positions(or screen to world positions when using the 3d space texture) on click and translate those screen positions to your texture (texture.setpixel).. Depending on how complex you want the paint functions to be u expand on this basic functionality.
After this part its an easy step to apply your texture to an existing material (Material.SetTexture) or save the texture to a png file (https://answers.unity.com/questions/1331297/how-to-save-a-texture2d-into-a-png.html)
good luck!