0
\$\begingroup\$

I'm trying to make a Color Rings game. When I try to set 3 tiles (rings) in the same cell of the board (same X/Y coord), it shows me only one, the last one in the script. For example, in this case:

tilemap.SetTile(Vector3Int.zero, red2);
tilemap.SetTile(Vector3Int.zero, red3);
tilemap.SetTile(Vector3Int.zero, red1);

You can only see the red1 tile. If you change the order and put say red2 in the end you will see red2 and only red2. There's no way they block each other, cause you can see the board behind them in the central part. What do I do wrong?


This is how the game should look:

enter image description here


And this is what I actually get when I run: enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ This does not look like a good use case for the TileMap at all. Have you considered not using it? \$\endgroup\$
    – DMGregory
    Dec 8, 2022 at 20:17
  • \$\begingroup\$ @DMGregory 1) Why not? 2) What would be a better alternative in your opinion? \$\endgroup\$
    – kozavr
    Dec 8, 2022 at 20:27
  • 2
    \$\begingroup\$ 1) Because you want to stack multiple tiles in a single slot, which as you've discovered, is not a use case TileMaps are designed to serve. 2) I'd just use plain sprites, not tiles, and set their positions to the locations of my 9 cells. \$\endgroup\$
    – DMGregory
    Dec 8, 2022 at 20:31
  • \$\begingroup\$ @DMGregory thanks \$\endgroup\$
    – kozavr
    Dec 8, 2022 at 20:56

2 Answers 2

3
\$\begingroup\$

The only good solution I can think of is to create 3 separate Tilemaps on 3 different layers. I have done this before, and it can be useful if you need a certain square to fire off separate methods when using scriptable objects.

If parts of your tile are transparent, you should be able to achieve the desired result.

\$\endgroup\$
0
\$\begingroup\$

Now you can set multiple tile in one place by changing Z-position: enter image description here

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .