Author Topic: UI Label Break words  (Read 3353 times)

nilton_felicio

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
UI Label Break words
« on: October 23, 2015, 07:37:06 AM »
Hi.
I'm having trouble with UILabel.
I apologize for my google English.

Unity 3d 5.2.1f1
Playmaker 1.7.8.3p2
NGUI 3.9.4b

The screens that follow are only an example, I made notes on them.

In my game texts are dynamically changed several times according to user interaction.
The problem is that when loaded with the text through a String Global Playmaker, The texts are justified through the character, causing the line breaks in the middle of words. The texts are configured to align the left.
Sera that this string has to be treated before being loaded into the UI Label?

2 following examples.
Before play.

IMAGE
https://www.dropbox.com/s/5eavkvmmy45lqc5/1.jpg?dl=0


To play with the code as well.
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class setTextNGUI : MonoBehaviour {
  5.        
  6.         void Start() {
  7.                 string txt = "Não se preocupem com nada, mas em todas as orações peçam a Deus o que vocês precisam e orem sempre com o coração agradecido. E a paz de Deus, que ninguém consegue entender, guardará o coração e a mente de vocês, pois vocês estão unidos com Cristo Jesus.";
  8.                 UILabel lbl = GetComponent<UILabel>();
  9.                 lbl.text = txt;
  10.         }
  11. }

IMAGE.
https://www.dropbox.com/s/hwibowav87uiymg/2.jpg?dl=0




Causing the problem:
  1. using UnityEngine;
  2. using System.Collections;
  3. using HutongGames.PlayMaker;
  4.  
  5. public class setTextNGUI : MonoBehaviour {
  6.        
  7.         void Start() {
  8.                 string txt = FsmVariables.GlobalVariables.GetFsmString ("msgTexto").Value;
  9.                 UILabel lbl = GetComponent<UILabel>();
  10.                 lbl.text = txt;
  11.         }
  12. }

IMAGE
https://www.dropbox.com/s/79iq7r68ih342b4/3.jpg?dl=0



I'm using void Start () only for testing. It will be a function called via a button.
Could anyone help me? Am I doing something wrong?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Label Break words
« Reply #1 on: October 24, 2015, 04:44:45 AM »
That's not NGUI's doing. Something differs between the two strings and you need to figure out what that is. Null spaces between letters would do this, for example.

nilton_felicio

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: UI Label Break words
« Reply #2 on: October 24, 2015, 10:06:57 AM »
Hi ArenMook.

I understand that you may not ngui.
But.

There is no Null spaces between letters.
The two variables contain the same texts.

string txt = "Não se preocupem com nada, mas em todas as orações peçam a Deus o que vocês precisam e orem sempre com o coração agradecido. E a paz de Deus, que ninguém consegue entender, guardará o coração e a mente de vocês, pois vocês estão unidos com Cristo Jesus."

FsmVariables.GlobalVariables.GetFsmString ("msgTexto").Value = "Não se preocupem com nada, mas em todas as orações peçam a Deus o que vocês precisam e orem sempre com o coração agradecido. E a paz de Deus, que ninguém consegue entender, guardará o coração e a mente de vocês, pois vocês estão unidos com Cristo Jesus."

Only ngui is working with the contents of the variable of a strange way.
He works letter after letter, counting the spaces between words, and what does not fit the width is thrown line underneath.
Are not only the words of the example that was the problem, that is a word that goes beyond the edge of the width is broken between words.
If you see the third photo to send earlier, letters are being justified when I configured to align the left.

When the correct word after word would count and what does not fit in the width would play the last word to line underneath.

Debugging the global String, check that it is correctly returning without spaces or any other problem. The problem only happens when I want to write it on the screen using UI Label.

If you think I'm doing something wrong let me know I need help and not just a response saying: "That's not ngui's doing.".
Let us together find a solution to my problem, ngui appreciate with 10 stars. Bugs if there is possible in any application. So we have to understand and try to correct. If the error is being my about the misuse of ngui guide me so I can do it right.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UI Label Break words
« Reply #3 on: October 27, 2015, 12:27:35 AM »
Well use logic here. When you set the label's text via code, it works fine, right? That means NGUI works. Then you go through Playmaker and it doesn't...

nilton_felicio

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: UI Label Break words
« Reply #4 on: October 27, 2015, 12:57:33 PM »
OK.

Thanks for your help and great support with your product.

I managed to solve the problem. Removed ngui of my project, I'm using Unity GUI it's all working.

Just use the logic here. If playmaker with ngui does not work, but playmaker with uGUi is working properly. where is the problem?