[ad_1]
I’ve the next Unity Visual Script triggered on a Start:
It seems at a toddler GameObject that makes use of Rect Transform and has a Text Mesh Pro part, and makes an attempt to calculate the width of the textual content utilizing the Get Size Delta of the Rect Transform.
Here’s the odd factor: the connected script all the time returns a width of 0. I feel that is as a result of the script is triggered on Start, and by then possibly the anchors have not been set but. That’s my idea at the very least, as a result of if I run this very same code on one other occasion apart from Start… the Size Delta returns acceptable information, and it all the time calculates the width correctly.
I’m fairly positive I may set some kind of time-based delay, and I’d get the correct outcomes… however I’d like to know the problem higher and never simply kludge it.
When precisely do anchor factors get set? Is there a method I may name this code in such a method that it persistently generates a width that is non-zero?
[ad_2]