1
Support / Need help with Word Wrap in text mesh
« on: January 19, 2013, 05:16:10 am »
I'm having trouble getting the word wrap width option to work correctly. When I adjust the properties this way and look in the editor while the game is running, the proper number appears in the word wrap field and the formatting box is checked. Am I not understanding something correctly? My thinking was that the width was a number of characters the string would display before moving to a new line where it would repeat that process.
I am looking to have the text appear on multiple lines and so far I can't find anyway to do so in code.
Thank you for any help. It will be very much appreciated.
I am looking to have the text appear on multiple lines and so far I can't find anyway to do so in code.
Thank you for any help. It will be very much appreciated.
Code: [Select]
public void Awake()
{
textMesh = GetComponent<tk2dTextMesh>();
textMesh.formatting = true;
textMesh.wordWrapWidth = 15;
textMesh.Commit();
textIndex = 0;
_TypedStates = typedStates.waitingToBeTyped;
}
public void UpdateText(float GameTime)
{
if(_TypedStates == typedStates.Typing)
{
if(GameTime > lastUpdateTime + textTypeSpeed)
{
textMesh.text = fullString.Substring(0, textIndex);
lastUpdateTime = GameTime;
textMesh.Commit();
if(textIndex >= fullString.Length)
_TypedStates = typedStates.FinishedTyping;
else
textIndex++;
}
}
}