1
\$\begingroup\$

I would like to make a game called 15 puzzle. But I'm not a designer. I'm interested more in programming side of the process. So for this project I need some really simple squares with numbers. I've made a png image using Paint but all I could get is to add the image to the Assets folder. I couldn't add it to a gameobject. I think I'm missing something. Probably smth about textures. In short, some guidance would be apreciated.

This is how it looks like

\$\endgroup\$
3
  • 1
    \$\begingroup\$ For this you neither need textures nor 15 seperat images. A single tile in the background of your choice. Add a text input on it. But you are probably better of to do a basic unity tutorial on YouTube about sprites and come back with your exact problem you are now facing \$\endgroup\$ Commented Nov 26, 2022 at 17:49
  • \$\begingroup\$ I've found the answer. Create a child and add "TextMeshPro - Text" Component to it. It needs some adjustments, but then it works fine. \$\endgroup\$ Commented Nov 26, 2022 at 19:27
  • \$\begingroup\$ When you want to share an answer to your problem, you should post it in the "Your Answer" box below, not in a comment. However, I'd argue that "here's how to add text" does not answer the question "How do I use images?" - so you might also want to edit your question to focus on your actual problem: "How do I make square tiles with numbers on them?" \$\endgroup\$ Commented Nov 27, 2022 at 15:43

1 Answer 1

1
\$\begingroup\$

Create a child of the tile and add "TextMeshPro - Text" Component to it. It needs some adjustments, because the text frame is way bigger than the tile, but then it works fine.

\$\endgroup\$
1
  • \$\begingroup\$ You could include some screenshots of your scene setup or from your GameObject Tile you use to create it. TextMeshPro has an option to scale the text automatically to the size of the box. And the game looks simple enough that you could fit everything in the canvas, avoiding converting. \$\endgroup\$ Commented Nov 28, 2022 at 8:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.