TextMeshPro comes in as giant text and I have to scale it all the way down and it won't anchor

Not sure what’s happening here with TMP, but I can’t get it to be the right size. It floats off the screen when I play the game, but it does update the score in the scene window. Notice how I’ve had to scale it down to 0.05 X & Y just to get it the right size.

19%20PM

I guess this is how you fix it. :frowning:

Hi,

If you look at your Game view you’ll note at the top the Scale is set at 2. You are therefore zoomed in. This is most likely why your text is disappearing off of the screen in your current Game view window.

Hope this helps. :slight_smile:

Interesting. I didn’t notice that, but there doesn’t appear to be a way to make it any lower. I’ve wrapped it up --moving on to Laser Defender now. Cheers!

Hi,

If you would like to share your project files I’ll happily take a quick look.

The forum will allow uploads of up to 10MB, if your project files (zipped) are larger than that you would need to use a service such as Google Drive or Dropbox, and then share the URL.

Wow! Thanks! Here you go: https://drive.google.com/file/d/16RLpmTD6ITmNqGdj7n7wPoX7F9yNhPyU/view?usp=sharing

Hi,

Sorry, I can’t see what the problem is?

When I run your game it looks fine in the Game view, and for me the scale is set to 1.

I’ve looked at the canvas and the specific TMP Text GameObject and that has a scale of 1, 1, 1, not the decimal you have in the first screenshot.

I can’t quite tell what it is you are saying you have done to resolve the issue at your end between the two posts either? Presumably you anchored it?

All looks ok from what I can see…?

Yeah, I got it anchored and everything works. I guess what is most confusing to me is that I had to anchor it way up to the right of where the background is. I’m not totally clear on why we need to make the game so much smaller than the canvas, but presume it’s due to Unity being a 3D platform. I totally appreciate you taking a look. I’m really looking forward to getting to the iOS/Android deployment section of the course. It’ll probably become more clear to me as I build more games.

The canvas looks so big because Unity displays it as 1 pixel = 1 world unit. When you run your game the canvas is then rendered as you would via the camera.

If you meant in your first post that the canvas was huge, then yeah, that’s normal, and if you meant that you had to place the Text UI GameObject in the right hand corner of the canvas which was a long way away from the tiny background image, then again, that’s all normal.

Yeah, I noticed after I posted, that in Rick’s videos, it was similar. I spent a lot of time in Flash years ago, and I like Unity a lot, because it’s a similar workflow. I think I just need more time in the chair to understand these nuances.

1 Like

The seemingly over-sized canvas throws quite a few people, I wouldn’t worry too much about it.

You’ll invariably encounter the same thing within Laser Defender - on that note, I’ll look forward to seeing your version :slight_smile:

Hi,

I just noticed that in your 1st screenshot you are trying to display your score text by setting it’s location on the background image. Presumably that’s why you had to scale it down to 0.05.
The reason this didn’t work out was because:

As Rob sir said, the canvas appears to be way bigger than your play space in the scene view, but when you run the game, it is rendered to the camera size.

So, when you set your score text according to your background image in the play space, it was too small in relation to your canvas. I think you would still be able to see your score in the game tab by pausing and zooming in at the bottom left corner (because that is where the score text actually is in relation to the canvas), but it might just be a white dot(if your font color is white).

In your second screenshot, you fixed the problem by setting your score text’s location according to the canvas and on the top right hence getting rid of the issue in the first screenshot.

I hope I didn’t make a muddle of my explanation. :sweat_smile: Basically what I am saying is, in your first screenshot, the position of your score text game object is on the lower left of your canvas and it’s size is very small too (0.05 scale). So when the canvas renders via the camera, the score text accordingly gets rendered to the lower left of your game screen and hence is very very small. Therefore, the UI elements should be positioned according to the canvas and not the play space which is how you fixed the issue (screenshot 2).

I hope I was able to explain it properly and I hope this helps. :grinning:

Cheers!

1 Like

Privacy & Terms