Implementation Steps with Unity3DFarsi

In Unity, RTL (Right-to-Left) text is not supported by default and requires additional code or a Unity package to function properly.

Unity3DFarsi provides an alternative method to enable Right-to-Left (RTL) writing systems within your Unity project, specifically designed for Arabic and Farsi (Persian) languages.


Add the Unity Package:

  1. Download the Unity Package from:

  2. Go to "Assets -> Import Package -> Custom Package". Then select the ARwayKit SDK .unitypackage.

  3. In the "Import Unity Package" window and click "Import" on the bottom right.

  4. A pop-up will appear for the precompiled assemblies, click "Yes" to update them for the changed Unity API:

    1. Assets/AssetStoreTools/Editor/AssetStoreTools.dll

    2. Assets/AssetStoreTools/Editor/AssetStoreToolsExtra.dll

  5. Wait for the scripts to finish compilation.

  6. The in the file Assets/Scripts/SampleFa.cs, change line 26, public GUIText gTEXT; to public Text gTEXT;

  7. Then change line 33 from gTEXT = GameObject.Find("GUI Text").GetComponent<GUIText> (); to gTEXT = GameObject.Find("GUI Text").GetComponent<Text> ();

Create a New Script for RTL Conversion:

  1. Navigate to Assets\ARWay\ViewerMode\2_Scripts\ in your Unity project.

  2. Create a new C# script file named MakeRTL.cs and add the following content:

using UnityEngine;
using UnityEngine.UI;
using TMPro;
using System.Collections;

public class MakeRTL : MonoBehaviour
    void Start()
        // Find all TextMeshPro components in the scene
        TextMeshProUGUI[] textMeshProComponents = FindObjectsOfType<TextMeshProUGUI>();

        // Process each TextMeshPro component
        foreach (TextMeshProUGUI textMeshProComponent in textMeshProComponents)

        // Find all Text components in the scene
        Text[] textComponents = FindObjectsOfType<Text>();

        // Process each Text component
        foreach (Text textComponent in textComponents)

    void ApplyRTLText(TMP_Text textComponent)
        // Apply RTL text processing only to TextMeshPro components
        if (textComponent is TextMeshProUGUI)
            TextMeshProUGUI tmProComponent = (TextMeshProUGUI)textComponent;
            string fixedText = GetFixedTextFromRTL(tmProComponent.text);
            tmProComponent.text = fixedText;

    void ApplyRTLText(Text textComponent)
        // Apply RTL text processing to Text components
        string fixedText = GetFixedTextFromRTL(textComponent.text);
        textComponent.text = fixedText;

    string GetFixedTextFromRTL(string originalText)
        string fixedText = originalText.faConvert();
        return fixedText;

Attach the Script to a GameObject:

  1. In the Dashboard-SDK and ARMapSession scenes, open the folder Assets\ARWay\ViewerMode\0_Scene\.

  2. Create a new empty GameObject.

  3. Select the new GameObject and click the "Add Component" button in the Inspector tab.

  4. Search "Make RTL", and select it from the list.

Set the Locale to Arabic:

  1. Open the file Assets\ARWay\ViewerMode\2_Scripts\Localization\LocalizeManager.cs.

  2. Modify the function at line 34 as follows:

public void ChangeLocale() 
  1. Add Arabic Text to Selected Objects:

    • Next, select the text objects in your scene and input the Arabic or Farsi text accordingly.

Replace the Project Font with a Font that Supports RTL Text

The fonts used in the project can be found in the folder Assets\ARWay\ViewerMode\3_Assets\Fonts\

.TTF Fonts

The following .ttf files need to be replaced:

  1. Poppins-Bold.ttf

  2. Poppins-Light.ttf

  3. Poppins-Medium.ttf

  4. Poppins-Regular.ttf

  5. Poppins-SemiBold.ttf

Using your new selected font family, rename the files to match the above and upload them to the folder replacing the existing files.

.ASSET Files

The same needs to be done to the following .asset files:

  1. Poppins Floor.asset

  2. Poppins-Light SDF.asset

  3. Poppins-Medium SDF.asset

  4. Poppins-Regular SDF.asset

  5. Poppins-SemiBold SDF 3D.asset

  6. Poppins-SemiBold SDF.asset

This GitHub repo here has a good guide on how to create font assets for RTL languages:

After creating the new .asset files, rename the files to match the above and upload them to the folder replacing the existing files.

By following the implementation steps outlined above, you can seamlessly integrate RTL text capabilities into your Unity project, ensuring accessibility and readability for a wider audience.

Last updated