how create a coloring in game in unity

I’m creating a coloring game where they can colour anywhere on the image except for a certain section. Can I get help to lead me in the right direction Please? thanks in advance =)

It may not seem like it, but this is actually a tough game to build if its your first game, especially in Unity.

You see, the simplicity of Unity comes in the fact that you’re working with objects and components of those objects, for the most part, but what you want to do involves ignoring all that and working with textures and graphics processes directly.

If you want to tackle it head on, though, check into these topics:

  • Render to Texture (A texture is an image in memory, either loaded from file or created like a blank canvas)
  • Render Buffer (really just another name for the target texture)
  • Shaders (The code for graphics cards that does crazy stuff really fast)
  • Masks (Lets you prevent certain areas getting painted to)

The general approach is, on click or drag, render the paintbrush texture to the canvas buffer texture, and; Every frame, draw the canvas buffer texture to screen.

That’s the core of painting on click, you can then expand to use different paintbrush textures to get different basic shapes / masks to prevent painting certain areas / shaders to make different effects.

Good luck!

Or to have an easy start, just try with Raycast & SetPixel

(so you can draw into the texture)

Then its just a matter of not drawing into all areas,
if for example GetPixel gives you a certain value…