Text tweening starts typing words on the incorrect line
« on: December 16, 2015, 11:40:15 PM »
Hi, I have another question about the text reveal tweening.

When a text field that wraps is tweened, it will start revealing characters for a word on the incorrect line, then snap the word to the next line when it gets too long. I understand that this is probably happening because the characters are appended one by one to the field, but it creates a very disjointed and distracting effect:



Would it be possible to account for this in the text tweening?

Thanks!

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Text tweening starts typing words on the incorrect line
« Reply #1 on: January 09, 2016, 02:21:52 AM »
Hi, and sorry for the delay. Notifications got messed up and didn't reach me :(

First of all thanks for the clear gif, which explains what you're asking perfectly. That said, I'm afraid that right now that can't be accounted for, since DOTween simply tweens a string, but doesn't "know" where it's going to be displayed (nor it wants to know, because that information would make the tween data heavier). Still, I'm going to think about it and see if I can develop some kind of tween plugin to take care of that, but it might take some time.

Cheers and sorry again,
Daniele

Re: Text tweening starts typing words on the incorrect line
« Reply #2 on: January 09, 2016, 03:36:46 AM »
No worries :)

We ended up developing an internal solution to this using http://docs.unity3d.com/ScriptReference/TextGenerator.GetPreferredWidth.html. We pre-calculate linebreak positions and then feed that to DOTween, and it all works out.

Thanks!

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: Text tweening starts typing words on the incorrect line
« Reply #3 on: January 09, 2016, 12:09:32 PM »
Ah, great, that is very interesting and seems the smartest solution! I'll keep that in mind, thanks for sharing :)