Get Updated Cocos Creator Label Size with UITransform and Next Frame
To obtain a label’s updated dimensions after changing its text, wait until the label has processed or rendered the new content before reading its UITransform.
Change the Label Text
Replace LabelNode with the actual node name used by your scene.
Wait for the Label Update
Scheduling the size read allows the label layout to refresh first:
| |
For modern Cocos Creator code, also consider scheduleOnce or waiting until the next frame, depending on when your surrounding layout updates.