简体   繁体   中英

In Unity GUI, when change button fontsize, how to change button size to wrap text

for ex, here is my button:

在此处输入图片说明

I set button fontsize to 50, to button height, I change it > 50 will wrap text, but in button width, I don't know how to calculate text width so cannot determine button width

so how to determine button width to make sure button can wrap its inner text

我找到了解决方案,使用UnityEngine.UI.Text#preferredWidthUnityEngine.UI.Text#preferredHeight

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM