This is Unity Paint, a small painting application made with Unity 3D.

Unitypaint is a painting script to make it easier for game developers to paint on a texture.

Features:
Line drawing
Vector drawing
Brush drawing
up to 32x anti-aliasing

Check out the example web-player to see what you can do with it.

Licence:

As of late 2011 the Unity Paint project may be used however you want, no restrictions. However a credit is always nice : D

Download:

Then it is just to download!
[download#6]

Faq:
API

57 comments

  1. BestSusanna says:

    I see you don’t monetize your page, don’t waste your traffic, you can earn additional bucks every month
    because you’ve got hi quality content. If you want to know how to make extra money,
    search for: Ercannou’s essential adsense alternative

  2. Gotama says:

    Big thanks for the free project!!! It was very helpful.
    It has been already 3 years as I implement some of the logic inside my Android 2D letter tracing game.
    I want to share my contribution for the community:

    OPTIMIZATION OF LARGE TEXTURES
    Was problem until yesterday. It was very slow and glitchy for devices/screens with high resolution.
    Because many maths were performed every frame for so many pixels.

    After many hours working/testing on optimization of color manipulation connected with [SetPixels]
    I found workaround:
    – Set size of the texture to power of two, but use 1 level smaller than needed (in my case Screen.Height)
    – Set transform.localScale = 2 on the GO where texture is implemented
    – Do some tweaking in mouse/touch position detection
    – Do some aligning/offset of the transform (where texture is) to match upper right corner of the texture to the Screen

    RESULT – incredible speed improvement, finaly line is smooth when swiping is very fast!

    • cemck says:

      Hey do you have a sample project to share the code on GitHub maybe? I’m new to unity and can’t get smooth drawing on touch screens, you could help me so much!

  3. Ali Khalil says:

    Greetings,

    We the Abu Dhabi Capital Group invite you to partner with us and
    benefit in our new Loan and Project funding program. We offer flexible
    loans and funding for various projects bypassing the usual rigorous
    procedures. This Funding program allows a client to enjoy low interest
    payback for as low as 3 – 4% per annum for a period of 15-20 years. We
    can approve a loan/funding for up to USD 800,000,000.00 or more
    depending on the nature of business. We are currently funding for:

    * Starting up a Franchise
    * Business Acquisition
    * Business Expansion
    * Commercial Real Estate purchase
    * Contract Execution

    We are open to having a good business relationship with you. If you
    think you have a solid background and idea of making good profit in
    any venture, please do not hesitate to contact us for possible
    business co-operation.

    Best Regards,
    Abdul Khalil Ali
    Chief Investment Officer
    Abu Dhabi United Group,
    Abu Dhabi,
    United Arab Emirates.

  4. corpsinhere says:

    This does look like a very useful tutorial project!
    I am using Unity 5.3.4f1 and there are some problems:
    This version of Unity is not tolerant of missing “var” declarations.
    Loading old asset DB format no longer supported; upgrade process should have deleted DB from Library folder!
    sun.flare and blue sky.mat are missing.
    For many assets: ‘ProjectSettings/InputManager.asset’ is in assets but has no assettimestamp…

    Thanks for creating this for the community :)!
    Broos

  5. Benraj SD says:

    For static image size its working fine, when i draw image and image rect with screen.width and height, its not working properly. Could you please help me to sort this issue.

    Thanks,
    Ben

    • PTS says:

      I have a question.

      In order to use this project is the work that needs to change the format of the file first.

      In the case of PNG image files are compressed and then change the status to RGB24 format should stick to baseTex figure is drawn.

      How to draw a direct methodology in the PNG file?

  6. douoht says:

    Hello there,

    I was interested in your project back in the days.
    Now i am really interested in continuing it in my free time for some project that i would like to create using your source code. Though i found out that JS is not the best solution for it i spent 30 mins of life to convert it to C#.

    I kept the same project structure as you did and it works the same way.

    So for everyone that wants an implementation for C# here it is(You can find C# scripts inside Assets/Scripts/C#PORT folder ): https://www.dropbox.com/s/en56h0jqc0ozo6d/UnityPaint.7z?dl=0

    • Olivier says:

      Hi,
      Thanks for this C# version of the scripts. When I open the project, it’s the JS files wich are in use, how could I use the C# scripts ?
      I want to use the scripts to lake a tool to learn prehistory and rock art to childrens… Do you know how I could use the project to paint directly on a meshes, in 3D mode, without GUI, but just with the brush ?
      Thanks a lot if you can help me…
      Olivier / France

      • douoht says:

        To be honest have not yet played that much with it as i am already having many things to handle in work. Speaking about the 3Dmeshes paint thingy.

        If you check the example screen that the project has implemented i changed the js script with the c# one and it gets the job done with the same way the js does.

        I will be searching for a solution to your problem when i have some more free time (yeah i have one more project that i want to develop for myself) and i’ll post back here. On the other hand you can contact me at douoht on facebook to talk about it.

        Cheers mate greetings from Greece.

  7. Kristofer says:

    I read a lot of interesting posts here. Probably you spend a lot of time writing, i know how to save
    you a lot of time, there is an online tool that creates high quality, google friendly posts in seconds, just type in google – laranitas free content source

  8. Amera says:

    HI,

    Is there any way i can use this project to draw via brush on cube or sphere on screen ,,, i;e if my camera is pointing to an object and i want to paint on top of that or ,,, if i can view that 3D object in the background and paint on a 2D plane…..

  9. kashif says:

    Hi,

    I am trying to use your script to draw brush lines over a 3D model in model viewer, but if i draw something and stop the program and then restart the lines are still there , is there any way i can just clear the screen when i exit the program or stop the program, also or if there are more controls on the screen as soon i click on paint deactivate button of paint brush all the paint brush work on the screen goes away

  10. Vik says:

    Actually I am trying unity paint on IOS.But it not make color perfect.Any Suggestion??
    Thanks in Adv

  11. Tony says:

    Some simple but very useful advice:
    Currently texture.Apply(); is in every one of the draw functions (DrawLine() for example), texture.Apply() is extremely slow as mentioned in the unity documentation.

    Texture2D.Apply
    This is a potentially expensive operation, so you’ll want to change as many pixels as possible between Apply calls.

    I tested drawing 1000 lines with your code, there was noticeable lag (0.5s or so). I moved texture.Apply(); so that it was outside the draw function so that it was only called once. No more noticeable lag. I suspect that this will speed up your draw bezier as well.

    I also understand that you might be performing sampling to the texture for color blending, and the solution I mentioned above would mess that up (since all the lines would be drawn at once, later lines cant blend with previous lines). A possible solution would be to draw the pixels on to a 2d array save that array and sample from that. A bit more complicated, but the speed gains are tremendous.

    Other than that, your code is wonderfully useful. Thank you very much for sharing!

    • Tony says:

      Oh wait, PainLine() doesn’t have texture.Apply() in it. And thus distinguishing the difference between PaintLine and DrawLine. A bit more documentation to clarify this would be helpful.

    • Vik says:

      I am working with Ipad painting.It is lagging somewhere.What can i do to increase the speed of coloring.???

  12. Silas Friedrich says:

    Hi, i try to make a android game where you can edit your picture. But the GUI Skin is much smaller at the android phone. How make that the GUI skin is the same size than the screen?

    • Vik says:

      Its simple!!
      You have to edit the painter script and comment the both GUIlayout area.It will solve you problem. 🙂

  13. Ganesh says:

    Hey hi,
    I liked you paint tool so much and I am trying to add more features to it like different types of brush shape and different textures to draw but I am getting problem with it.
    So if you have any updated version of this UnityPaint then please share or give any tip to implement the above.
    Thanks 🙂

  14. Ganesh says:

    Hey hi,
    I liked your painting tool and am trying to add new things in this but getting some problems.
    So do u have any Updated version of this so that I can refer it.
    Actually I am try to add different shapes of brushes and different textures to print on the background.
    Please help.. 🙂
    Thanks,

  15. Mark says:

    Hey I was want to use this in 3d space too, will it work? If not can you please explain how to change it to 3d or make a 3d version, it would be much appereciated thanks

  16. Marty says:

    I’ve been parsing UnityPaint and it’s awesome but I was wondering if you had a stripped down section of code that just places one texture on another with alpha-blending? And if you maybe had a version thatuses RenderTexture instead of SetPixels?

  17. anonymous says:

    Hi, i have a problem with the first person controller in UnityPaint. I can place it, but there is this weird white box when i click play, and I cant move, only look around. Please tell me how to get rid of the white box and painting tool, or at least how to move. Thanks.

    • Aron Granberg says:

      Hi,
      I have not worked on this project for a long time. So I won’t be able to help you there. But I think you could get rid of the white box just by disabling the painting script.

  18. Brad says:

    I was wondering if there is a C# version of this project when I tried to port it over I ran into a few problems with the painter script.

  19. Krodil says:

    hey, thanks for UnityPaint, it is really nice. 🙂
    I have a question: I want to save my drawing out on disc, then with a button create a new texture2d to draw on etc.
    Do you have any pointers about this?
    Even if I take screenshots, the paint is not visible.

    The code below is me making a new texture (from a button), which works but only exists in runtime.
    function newTexture () {

    //var tex = new Texture2D(128, 128);
    //baseTex = Resources.LoadAssetAtPath(“Assets/background2.psd”, Texture2D);
    baseTex = new Texture2D(1024,1024);
    //renderer.material.SetTexture(“baseTex”, tex);
    CaptureScreenScript.CaptureScreen();

    }

Leave a Reply

Your email address will not be published. Required fields are marked *