Score displaying in Unity but not in build

Hi all,

Really enjoying the series.

I’ve finished my Block Breaker game. Everything works great when I play it within the Unity program. Score displays and updates nicely, and resets on a new game.

However, when I click Build Settings and make a Build for PC, and then load the game from the application - the score does not display. Everything else works fine. All my other buttons show, everything works smooth - just no score.

Was wondering if others are experiencing this problem too?

I can copy my code up, but since everything works great in Unity, I’m not sure that is the problem. Maybe something else?

1 Like

I figured out the problem.

My monitor runs at a native 16:9 resolution. So despite Block Breaker being written in a 4:3 resolution, when I run the Build application my rig changes the game into 16:9. Since the score was in the top-right corner, the change in resolution pushes the score off the screen.

So if I change the Unity build resolution to 16:9 (which requires me to move the score over so it is now in view), and then make a new build - everything runs great.

Problem is, I can’t have the game in 4:3 anymore, as the score now floats more in the middle of the screen.

So with all that said, I’m wondering if what I am seeing is fine for where we are in the course progress. i.e… we will learn more about resolution changes later. Or, have I maybe setup something wrong as my build application should force the 4:3 resolution regardless of my 16:9 native display?

Figured it out.

Select the Canvas, and within the inspector -> Canvas Scaler - there is an option for ‘Screen Match Mode’. It defaults at ‘Match Width or Height’. Change it to ‘Expand’ and it will ensure the 4:3 resolution is maintained in your application build regardless of your native resolution.

You can adjust the resolution to anything within Unity, and the Game view screen will now auto-adjust everything nicely. Surprised this isn’t the default setting.

Anyways, hope this info helps if you’re having similar problems.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms