Change font-size according to resolution

I am currently developing a game off of a tutorial, the game is called laser defender and your goal is to shoot down enemies. The game seemed to be working fine in the inspector, but when I did a build of the game, and set my resolution to my computer’s resolution, this happened:

The text was tiny and some of the buttons would not work, Is there a way to fix this? I still pressed the play button, and the enemies seemed to be the same size, and were still working fine, one the UI elements were messed up.

if you could show me a way to fix this, it would be great! Thank you!

in cnavas make sure Canvas Scaler is Scale With Screen Size se doc Canvas Scaler

You can check ‘BEST FIT’ checkbox for the text fields in inspector to fix this.

You can set your Canvas’ “UI Scale Mode” under “Canvas Scaler” to “constant physical size”

it makes the UI elements maintain their original size. so they remain the same size even if the resolution changes.

and then you can use “Best Fit” for Text component which will make it appear better on the screen.