How to Make a Match 3 Game in Unity

Hi there!

If you do not use the template project provided you’ll need to make sure “Queries Start in Colliders” is checked off in your Physics2D settings (Edit >> Project Settings >> Physics 2D) and that should fix your raycast issue!

I have a better solution that seems to work so far – shift the tiles up if the top row is clicked on, down for the other rows.

Hi, I’ve been following this tutorial but I’ve hit a snag and can’t seem to figure it out.

In the section titled “Finding Adjacent Tiles” it says to replace a few lines in the OnMouseDown method with an if and then an else statement.

Upon testing the project however, OnMouseDown only seems to return results for the else statement, not the if statement.
Clicking a tile in the “Game” window deselects the previously selected tile, selects the clicked on tile and does not swap them.

Is there something I’m missing here?

Hopefully you can help me solve this problem
Thanks

Sorted this, I was using a BoxCollider, rather than a 2DBoxCollider

Hi i struggled at the same and found a solution i think work at least it worked in my test

insert this in ShiftTilesDown method:

if(renders.Count == 1)
            {
                renders[0].sprite = GetNewSprite(x, ySize - 1);
            }

just before this code:

for (int k = 0; k < renders.Count - 1; k++)
            {
                renders[k].sprite = renders[k+1].sprite;
                renders[k + 1].sprite = GetNewSprite(x, ySize - 1); 
            }

Great tutorial. Thanks so much. I tried to build for mobile and ran into a problem I don’t understand. The entire screen was stretched to fit the screen, so the square sprites were tall rectangles. Do you have any suggestions on what settings I should check?

Thanks!

Hey, thanks for the great tutorial. I am coming across one issue that I am not sure has been brought up yet. When I move a tile to an adjacent space that does not have a match, the tile will move instead of going back to its original space. I would like to have it that if moving a tile doesn’t match a match, the tile trying to be moved is returned to its original space and no turn is used. Can anyone help with that?

This tutorial is more than six months old so questions regarding it are no longer supported for the moment. We will update it as soon as possible. Thank you! :]