Author Topic: TypewriterEffect problem  (Read 3758 times)

Joyzh

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
TypewriterEffect problem
« on: June 18, 2015, 09:20:47 AM »
public void ShowDownMessage(string txt){
      label.text = txt;
      label.GetComponent<TypewriterEffect>().ResetToBeginning();
}

//not show correctly
IEnumerator Start () {
      ShowDownMessage("");
      yield return new WaitForSeconds(3);
      ShowDownMessage("abc");
}

//show correctly
IEnumerator Start () {
                ShowDownMessage("123");
       yield return new WaitForSeconds(3);
      ShowDownMessage("abc");
}

It's weird that I can not clear label by set empty text on a TypewriterEffect label.
Can anyone help me solve this problem?

NGUI 3.9.0b

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TypewriterEffect problem
« Reply #1 on: June 21, 2015, 06:24:24 PM »
Typewriter effect is supposed to work with text, but you aren't passing any. Why don't you simply set the text, and then if the string.isNullOrEmpty(label.text), then simply disable the TypewriterEffect instead of resetting it?