0

it works if I set the text value in inspector, but not in code, the horizontal overflow either wraps (if overflow is set to Wrap) or overflows (if overflow is set to Overflow), and the font size never scales to fit without wrapping nor overflow

Horizontal overflow is set to Overflow in code, but is set to Wrap in inspector Vertical overflow is set to Truncate Best Fit is checked, Min Size = 10, Max Size = 40

any help greatly appreciated

[Edit below, added code and screenshot of Inspector settings for text component]

dataText.horizontalOverflow = HorizontalWrapMode.Overflow;
dataText.horizontalOverflow = HorizontalWrapMode.Wrap;
dataText.text = " My Blablablablablatext---->>>>>>:\n______________________________________\n";
dataText += ">>>>>>>>and some more text"
dataText.resizeTextForBestFit = false;//Just added this to test, see if reseting would help, it didn't
dataText.resizeTextForBestFit = true;//Just added this to test, see if reseting would help, it didn't

enter image description here

  • interesting...in play mode I unchecked best fit in the inspector and then the font scale resized to completely fit without overflow or wrap, but the text was very small and didn't scale to fit the size of the text component – Patrick Grant Feb 14 '22 at 18:22
  • Could you show us your code? Sounds like you are rather using a TextMeshProUGUI component – derHugo Feb 14 '22 at 18:42
  • just edited question to include relevant code and screenshot of inspector settings for text component (don't know what Stack is doing to screw up the code formatting, couldn't fix it, I added it as code, but Stack fubarred the wrapping) – Patrick Grant Feb 14 '22 at 20:33

0 Answers0