Arabic Letters Support For Unity
This plugin allows you to use accurate and correct Arabic text in your game or 3D application. Supports Tashkeel and Hindu numbers. Supports 4 Persian Characters.
You can find it in the Unity Asset Store here: https://www.assetstore.unity3d.com/en/#!/content/2674
Also, check out UPersian. It uses this plugin to create these GUI items:
- RTL Text
- RTL Input field
- RTL Buton
- RTL Checkbox
Assalamu Alaikum! (Peace upon you all!) This asset will enable you to use Arabic Words in your game. There are two main problems to address here:
- Arabic Letters orders. It's like reading "Hello" as "olleH". السلام is displayed as: م ا ل س ل ا
- Arabic Letters connectivity. As seen here: “السلام is displayed as: م ا ل س ل ا” the letters are no disconnected.
Building The Project
You only need to use ArabicSupport.cs file in your project. So there is no real need for building. The rest of the files there are just for demonstration in a Unity Project in expectation of developers wanting to demo the extra features they add to the plugin.
The project should work on most unity versions for now until we start adding features that are available only in later unity versions.
Testing The Project
Usually the project is updated once a flaw is discovered, or something new needs to be added. In the scenes folder there is "Test Cases.unity" file that includes all previous tested words.
Follow the following steps:
- Make changes.
- Go and see the test case scene and check if something broke. (Sadly you'll have to know basic Arabic writing to know this)
- Add new words to the scene that you found that broke so others can also test it.
You can add your own test cases scene if it makes sense to you.
- You'll need to use a font that got Arabic letters in it.
- You'll need to modify the text attribute through script. This does not fix the problem if you write directly in a text field.
- The script is written in C#.
- The code is a little messy so please excuse me.
- To use the Unity Arabic Support asset inside a script, use: "using ArabicSupport;"
- After using the using statement, use the following method (returns a string): ArabicFixer.Fix(textToBeFixed);
- And you're done! You can use the alternative: ArabicFixer(string, tashkeel, hindoNumbers) for more customization options.
- You can now show Harakat such as ًٌٍَُِ~ّْ using the plugin. Also, you have option to remove the Harakat realtime by setting the plugin to ignore the Harakat by using the ShowHarakat() HideHarakat() Methods. Please note that not all fonts support the Harakat well. Arial font and Arabic Typesetting font were tested and words well. The default is to show the Harakat.
- You can now use hindu numbers instead of the default of the font if needed. (٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩) Use the UseHinduNumbers() and UseDeafultNumbers() method to switch your settings. The default value is not to use hindu numbers.
- 4 Persian characters have been added (3.0): چژ گپ
- Multiple lines are supported. However, you have to supply the breaklines to the Fix method yourself.
The text is not showing on your build?
- Click on the font you are using in the project field.
- In the inspector, find the "Character" field.
- Change it from dynamic to unicode.
I hope you'll find this asset useful and enjoy using it!
I'll be very happy if you showed me the game you used the plugin with! I don't mind a free copy of it either!