D
D
Dmitry Demidov2015-11-19 12:17:19
Game development
Dmitry Demidov, 2015-11-19 12:17:19

How to properly generate the playing field?

Good day.
I'm making a game in Unity. You need to generate a playing field filled with tiles. There are two requirements.
1. The field must be overlaid with a grid. That is, the boundaries of the game cells are clearly marked.
2. Each cell should display textual information (a number), with which I will work in the future - change, hide, etc.
Actually, questions.
1. How to correctly place the net on the playing field? What I found seems redundant.
2. I made the display of numbers by overlaying a smaller size on top of the background sprite. In this case, the sprite with the number is taken randomly from the array of prefabs. But digging among the components found GUI Text. I have not been able to display it yet, but it seems to suit me better. Maybe there is some other, more correct way to implement such functionality?
Thanks in advance for your replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Limarchenko, 2015-11-22
@ptitca_zu

It depends on how difficult the game is and what happens next. I recently made a simple game like 2048 entirely in UnityUI. That is, I only have Canvas and everything in the game is done using the UI. There is a GridLayoutGroup for building grids.
Found such a cool script and used it instead of GridLayoutGroup: www.justapixel.co.uk/ugui-auto-scaling-grid-layout-code
In fact, it also helps to organize the grid, only this one also stretches in size depending on the size of the Canvas.
If this is not suitable, you can create a Canvas for each tile, transfer it to WorldSpace and show GUI Text on it. I don’t know about the performance of such a solution, but in theory everything should work out.
I forgot to write - there is also TextMesh. Also suitable for displaying text. The most simple in your case in my opinion. Nobody has suggested it yet.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question