I have a situation where I want to have UILabel (WidgetA) with a child anchored to it (WidgetB) that will wrap around the UILabel. When I set a bunch of text to the UILabel, the label will expand for the text and I want to immediately have the child WidgetB update its anchors and expand to contain WidgetA. I want this to occur immediately so that I can immediately query the new size of WidgetB. How do I force these calculations Immediately?
As it stands to get this to work I can call
WidgetA.text = value;
//We must use "localSize" here as UILabels recalculate their text processing on when localSize is called.
//Calling localSize will force this recalculation immediately.
var size = WidgetA.localSize;
WidgetB.UpdateAnchors();
var sizeB = WidgetB.localSize; //<-- not going to be correct.
....
However at this point sizeB will not be correct. Later on in the Start() I'll be able to fetch the size of WidgetB and it'll be correct.
So my core issue is that I'm not really clear on how Anchors work at the low level. Is there's some aspect of their functionality that requires on the objects being active or enabled and UpdateAnchors() doesn't get around this? Is there a way to force the calculations immediately even if I'm calling on objects prior to their Start()?