Best Way To Achieve A Grid Based Game.
Hi Guys,
So recently I've been toying with the idea of creating a grid based game. I've been thinking about how I would create the effect of a grid and I've come up with a few solutions but am unsure of the best approach and I was just wondering what solutions other people might have or think is best? The game is really simple and it's just about placing an object in each grid square and then that square becoming occupied with that object so it can't then become occupied with another. There are no unusable grid squares (i.e. terrain) or any other restrictions. Here's how I thought I might do it:
Create an empty grid GameObject.
Create an empty grid square GameObject and add a box collider component.
Attach a script to the grid object which programmatically instantiates an X by Y grid of grid square objects.
Use raycasting to interact with grid square objects.
It seems a bit verbose to me and inefficient, I'm not sure what size grid I'm going to need (might end up being quite big) and I'm not sure about how this could affect performance or if there's a better way to do it.
Any ideas?
Your answer
Follow this Question
Related Questions
Position in grid 1 Answer
Getting World Space From Custom Grid 1 Answer
Positioning Screen Space UI element in center of a grid square? 1 Answer
How To Get Tile Cell Position 0 Answers
ProBuilder Element Snap to Grid (Unity 2020.1.2f1) 0 Answers