Author Topic: Possible addition to UILocalize  (Read 5310 times)

ranilian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
    • Industry Corporation
Possible addition to UILocalize
« on: June 17, 2012, 07:59:26 PM »
  1. mLanguage = loc.currentLanguage;
  2. if (gameObject.GetComponent<BoxCollider> () != null) {
  3. // Re-adjust the collider dimensions
  4. NGUITools.AddWidgetCollider (gameObject);
  5. }

To re-adjust the collider size of the text if it already has one on it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Possible addition to UILocalize
« Reply #1 on: June 17, 2012, 08:29:28 PM »
The collider should generally be added to the parent game object, not to the localized label/sprite. For example, "button" game object instead of the background sliced sprite or the text label under it.

ranilian

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
    • Industry Corporation
Re: Possible addition to UILocalize
« Reply #2 on: June 17, 2012, 08:32:42 PM »
That is true only if you have a background behind your text. In our case, the text is our button.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Possible addition to UILocalize
« Reply #3 on: June 17, 2012, 08:40:26 PM »
You can also create your own additional script with
  1. void OnLocalize (Localization loc)
...function inside. Inside this function you can resize the collider accordingly.