Painting tiles in a grid

Hello everyone,

I’m new to unity and I would be very grateful if someone could help me or tell me if there is any tutorial that could help me.

So basically I’m making a mobile game and I have already made a grid, that has 9 tile’s (3x3), and what I want are different color’s, for example black, white, red, blue and yellow, that I can pick and color a tile in the grid with it. So I have to color the whole grid as shown in another square that is up to the grid, and when I do this I switch to the next level. It’s kinda complicated but I really hope you understand what I mean.

Also for harder levels I had planned to make the color’s mixable, like when you color a tile yellow and then put red on it, it turns orange, or at first red and then blue, it turns purple.

I have been searching around in the web, searching for tutorials or any help, but I didnt find anything yet, and how I have already said, I will be grateful for any help.
Thanks alot


First, as you are new, I’m sure you will do more questions in the future, so…

  • Do only 1 question per post. If needed, make more than 1 post, 1 for each question.
  • Simplify the question, but give all essential info. sometimes, a draw, image, screenshot i better than words.
  • Make a good title, so people can understand your problem just by reading it at the main page

Now, lets talk about your problem…
Are your tiles diferent gameobjects? or Are you using the grid system of Unity? Did you tried something?

I just will give you some words and things to investigate:

GetComponent().material If want to change color, what you need to do i have different prefab materials and change them during runtime

Input.GetKeyDown() Detect when the player click any button (included mouse buttons)

KeyCode All keys stored, just find which key you need

void OnMouseOver()
        //If your mouse hovers over the GameObject with the script attached, output this message
        Debug.Log("Mouse is over GameObject.");

    void OnMouseExit()
        //The mouse is no longer hovering over the GameObject so output this message each frame
        Debug.Log("Mouse is no longer on GameObject.");

For now, you have work to do… Good luck!