Hello!
I would like to offer players a choice of font sizes (or a slider), to improve the accessibility of my game, as recommended here: https://gameaccessibilityguidelines.com/allow-the-font-size-to-be-adjusted/
If anybody has any tips on doing this either within or alongside the AC UI I would really appreciate it! I searched a couple of variations of this on the forum and couldn't find a previous discussion about it, but there is one, please do direct me there.
Thanks for reading,
M
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @MyDe_Lightful.
Firstly, I'd recommend switching your Menus to Unity UI if they aren't already. While it is possible to change the Font size of AC menus, Unity UI menus are much better at adapting to size changes, given components such as Content Size Fitter etc.
Each of AC's default Menus have Unity UI counterparts you can access by setting their Source property to Unity Ui Prefab. A guide to converting custom menus to Unity UI can be found in the Manual's "Unity UI menus" as well as this tutorial.
As for making the font size dynamic, you'll want to store the intended size as an Global Float variable in the Variables Manager. Create a new Float with the name e.g. FontSize and set its default value to the standard font size in your current UI Text components.
To have this variable affect the size of your fonts, you can then use a simple script to have it update your Text components. Something like this should do it:
Paste this in a C# file named DynamicFontSize and attach to your UI Text objects, checking that the "Variable Name" field matches that of your Global Float variable.
(You can check everything's working so far by changing the variable's default value and then running the game to see it take effect.)
To have this variable be something the player can change, you can add a new Slider element to your Options menu and link the Slider to this variable.
Finally, to have this variable's value be recorded in Options data, and not in regular save-game files, set the variable's Link to property to Options Data.