Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to enable or disable RTL editor value through Script?

Discussion in 'UGUI & TextMesh Pro' started by siddharth3322, Jan 27, 2022.

  1. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    As per my title suggest, how can I enable or disable RTL editor value through Script?

    Because I have multiple languages within the game and only Hebrew language from this required this RTL editor checkbox enabled, all other required this value to be disabled.

    So I must required to control this through script, please give your suggestion for this.
    enable - disable RTL editor.png
     
  2. jonathan_h

    jonathan_h

    Unity Technologies

    Joined:
    Jul 29, 2021
    Posts:
    18
    Hi,

    You can use the isRightToLeftText property to enable RTL. You simply need to set that property value to true in your script.
     
  3. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @jonathan_h Sorry sir, for bothering you multiple times in different issues :)

    Yes, now I understand that TextMeshPro - Text component has isRightToLeftText property and through this we can able to RTL editor within Script.

    RTL variable update.png

    I want to do settings like this way so manually I don't required to manage for Hebrew language.
    How to setup this? How checkbox will get tick mark when its Hebrew language?
    This I can't able to understand so please guide me into this.
     
  4. jonathan_h

    jonathan_h

    Unity Technologies

    Joined:
    Jul 29, 2021
    Posts:
    18
    Last edited: Jan 28, 2022
    karl_jones likes this.
  5. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    @jonathan_h After your above feedback, to enable isRightToLeftText value for Hebrew language I have done some exercise with GameObjectLocalizer script.
    Something like this way:
    gameobject localizer example.png

    This started working for me properly but one things I have noticed as problem.
    Overall this thing is working based on recording, Localization Scene Controls -> enable Track Changes to start record for that particular locale.

    Total I have 23 languages within the game so for a single Text field, I require to travel through 23 locales and enable or disable its Enable RTL Editor checkbox within the Inspector.
    Within the game I have many text labels and titles so if I prefer this way then it will become too time consuming and tedious task for me.

    Please suggest me some smart way to achieve the same :)
     
    unity_UTLRO2JE6PLPYg likes this.
  6. jonathan_h

    jonathan_h

    Unity Technologies

    Joined:
    Jul 29, 2021
    Posts:
    18
    siddharth3322 likes this.
  7. AmmarSalim

    AmmarSalim

    Joined:
    Sep 2, 2016
    Posts:
    25
    Just add this paragraph to the code:

    yourTextMesh.isRightToLeftText = true;