Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(3 edits)
<img src="<a href="https://img.itch.zone/aW1nLzc0MzI5Ny5wbmc=/original/sodrsd.png">https://img.itch.zone/aW1nLzc0MzI5Ny5wbmc=/original/sodrsd.png</a>">RebuildTextInfo

Whoa! Removing that, combined with changing my setting code to:

private void OnDialoguerTextPhase(DialoguerTextData data) {
   RectTransform dialogBoxTextTransform = (RectTransform) DialogBoxText.gameObject.transform;
   DialogBox.SetActive(true);
   DialogBoxText.text = LocalizationManager.GetTermTranslation(data.text);
   DialogBoxText.Rebuild();
   DialogFrame.sizeDelta = dialogBoxTextTransform.sizeDelta;
}

Makes it fit the text. However, how do I define how far it can go before it wraps?

 

Upon further inspection it seems like it makes it fit the longest word? 🤔

---

Edit 1

Looking at SuperTextMesh.cs:

if(uiMode && wrapText) return (float)((RectTransform)t).rect.width; //get wrap limit, within left and right bounds!

Seems like it's not respecting it in some way? Looking further...

---

Edit 2

Seems like AutoWrap gets reset somehow? Calling the code above calls RebuildTextInfo() three times with different AutoSize values:

---

Edit 3

Well, since SetMesh() overwrites the sizeDelta of the RectTransform, it changes the value to the new one (shrunk text), making it impossible to expand it to what it was set initially.

rect.sizeDelta = new Vector2(textMesh.bounds.size.x, textMesh.bounds.size.y);