private void SetTextBoxText(string text) { //unescape the string to allow newlines _currentAppendingText = System.Text.RegularExpressions.Regex.Unescape(text); //Text size needs a text mesh _textMesh.text = _currentAppendingText; TextSize ts = new TextSize(_textMesh); ts.FitToWidth(lineLength); //Retrieve the modified string _currentAppendingText = _textMesh.text; //Split the tag and the text from the whole text line string[] splitLines = _currentAppendingText.Split(delimArray, System.StringSplitOptions.RemoveEmptyEntries); //Catch if we split correctly if(splitLines.Length == 2) { _currentTBIdentifier = splitLines[0]; _currentAppendingText = splitLines[1]; HideAllTextBoxes(); ShowSpecifiedText(_currentTBIdentifier); } else { HideAllTextBoxes(); //manually set this to interactable tag because the split didn't work _currentTBIdentifier = interactionTag; ShowSpecifiedText(interactionTag); } //Clear the textmesh since we're going to be appending to it _textMesh.text = ""; StartAppendingText(); }
public void wrapTextTo(float wrapTo) { // print (ts.width); ts.FitToWidth(wrapTo); }
// Use this for initialization void Start() { ts = new TextSize(gameObject.GetComponent<TextMesh>()); // Debug.Log("Initial width of string: " + ts.width); ts.FitToWidth(lineWidth); }
public void ShowText(string text) { wallTextMesh.text = text; wallTextSize.FitToWidth(maxWidth, kMaxLines); }