Hi every body.
I want to implement Persian and other RTL languages in unity UI.
whats the entrance of my coding? Where should I start?
I found that in unity UI source there is a class named Text that implements simple label in GUI, in this class the code uses a class named “TextGenerator” that make the text mesh.
how can i make a new “TextGenerator” class witch supports RTL language.
I know that there is a Asset named “ArabicSupport” witch change the inputed string to characters that with a specific font, shows RTL in right state. but when the text is a multi line string, the whole text is Inverted (because this is a way to show RTL in LTR).
now i want to make a new mesh generator for RTL languages.
First and best solution is using Textmesh pro. Now it has TextMeshProGUI component which is the best choice for Arabic and Persian and RTL languages for UI and you can use it in canvas. having mesh in this component name Don’t let mislead you. It can be used in canvas and UI and is even better than default Text ui text component of unity. It has no any margin problem or multi line problem.
If you want a very quick solution you can use this package as simple as
for multi-line support you should set line spacing to -1.
Next solution is using the package you refer to or a better version can be found here. the only problem with this packages is some margin problems. but you should change all the text component with RTLText component so when TextMeshPro is available there is no any reason to use it anymore.
The last solution is to use this localization asset which has some auto fix for RTL languages. For multi line support you can set line spacing to -1 or it has a simple solution to break line on a constant length.