Using fewer Game Objects in a Tile-Based Puzzle Game?

I’m working on a matching-tile puzzle game where the player can move tiles, a row at a time - or every row at once. However, the player can also move certain columns of tiles up in certain circumstances. When the user moves a row to the left, the leftmost tile will be moved to the far right, and vice versa when moving to the right.

57529-tiles.png

Right now, each individual tile is its own Game Object with a sprite in it, which means that with a single row movement, 8 GameObjects are being moved (tweening is handled with the DOTween library), and in some instances it’s possible for up to 256 tiles/Game Objects to be moving at once.

The game runs at a solid 60fps even when this is happening on all of the computers I’ve tested it on, but once over 100 Game Objects are being moved at once, this leads to some slowdown in console development, and presumably on slower computers.

Is there a better way of handling this than having a separate Game Object for each tile?

There is at least one other way which I have personally implemented in my tile base platformer. I used to have 1 sprite / tile but performance-wise it was definitely not optimal. Now I use MeshRenderer to draw each group of tiles (4x10 tiles for example is now just 1 object with 1 mesh).

In your case in the end you could have 1 game object rendering all your tiles as the grid is already defined (let’s call it “AllTiles”). You will never have to actually move game objects, just to update the status of your tiles internally and update AllTiles accordingly by telling him which textures to draw at which position of your grid / mesh.

I learnt how to do it with this tutorial: Student Game Dev has moved!: Unity Voxel Tutorial Part 1: Generating meshes from code