- Home /
Implementing Persian(RTL Languages) in Unity UI
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.
any one could help me?
(Sorry for my bad english)
Answer by Decapitary · Dec 08, 2016 at 06:45 AM
Hi Make A Text in Photoshop and use and background Image. then swear as much as possible at this C#-using-CaveMen who develope Unity
Answer by 3d_Artist1987 · May 04, 2015 at 10:09 AM
check this link
Tank you devang_xprt but this is not what i expect. But now i have may own implementation of UnityUI that supports RTL Languages. Now i'm in the stage that i should improve the input filed to fully support Persian and Arabic language. So i my self could solve multiline problem of RTL languages.
Hello, Can you share your implementation?
Answer by esx2ve · May 19, 2017 at 01:56 PM
We have an InputField that supports RTL + caret handling
https://forum.unity3d.com/threads/released-native-rtl-input-field-with-correct-caret-handling.471403/ https://www.assetstore.unity3d.com/#!/content/87569
Answer by sajjadgameactor · Apr 21, 2020 at 06:24 PM
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
yourText.faConvert ();
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.
I set my line spacing to -1. but after that, my first line had a big space like a last line.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Change Material of quad in script c# unity 2d 1 Answer
Painting regions of a mesh segmentation in editor 1 Answer
Distribute terrain in zones 3 Answers