Hi! First of all, thanks for STM - it saved me hours. :D
I am using the uGUI flavor of STM. I am trying to do dialog textboxes where my frame shrinks if the text is small enough (in length), or grows in height once it reaches a maximum width and makes the text wrap. I hope that makes sense.
I can achieve this relatively easily with uGUI by having this setup (which consists of Horizontal Layouts and Content Size Fitters) but I noticed that STM wasn't actually getting its values driven by these components.
That's fine, I thought, I'll just implement the wrapping myself. I have it working, except for one last detail. Here's how I am changing my text:
private void OnDialoguerTextPhase(DialoguerTextData data) { RectTransform dialogBoxTexTransform = (RectTransform) DialogBoxText.gameObject.transform; DialogBox.SetActive(true); DialogBoxText.wrapText = false; DialogBoxText.Text = LocalizationManager.GetTermTranslation(data.text); if (dialogBoxTexTransform.sizeDelta.x > 500) { DialogBoxText.wrapText = true; DialogBoxText.Rebuild(); dialogBoxTexTransform.sizeDelta = new Vector2(500, DialogBoxText.textMesh.bounds.size.y); } }
The problem here is that DialogBoxText.textMesh.bounds seems to be set to the old bounds, even if I call Rebuild(). It gets updated after two calls to that method.
I've looked through the docs and couldn't find anything of help there... Maybe looping through the characters and identifying the actual mesh size? Do you have any advice on how to make this work?
Thanks again for an awesome asset! :D