Unity menu GUI in multiple resolutions

Today I've spent a lot of time trying to get a nice resizable menu for Astrofighter.Net and it's been a bit of a struggle so far.

My first approach was to use Matrix4x4.TRS to create a scalable 4:3 ratio menu GUI based on a coordinate system of 1600 x 1200. For wide screen resolutions I would simply add an offset to make sure the 4:3 menu system is always centered. It worked quite good in higher resolutions but as soon as a fairly mid-range to low resolution was used smaller fonts became pixelated and unreadable. How unfortunate because the matrix scaling was a one line solution.

I'm now working on my own approach. It basically still uses the 4:3 ratio menu with padding being added to the sides for widescreen resolutions. The difference is now that I recalculate the Rect positioning and width/height using my own function basically doing the same as the Matrix4x4.TRS scaling. The difference is that I now also manually set the font size using the same scale, but with an integer, so the font always looks crisp.

The status now is that I've got a nice resizable GUI with crisp fonts in any resolution. It's quite a bit of extra work but I think it's worth it.

If you are interested in the code - please let me know. I'll probably make it available in the Unity wiki or forums once I'm finished.

Comments

Popular posts from this blog

Leaving The Outpost (Game Music)

What is music worth to you

Three new tracks released