I’m instantiating a prefab that calculates its own size depending on the context (basically the description text on it), because of some animations I can’t use the VerticalLayoutGroup to position them because I have some animations in place and it gets in the place.
Everything is fine with this setup except for 1 thing, the sizeDelta of the objects doesn’t update in the same frame, but it takes 2-3 frames to give the final value even if the visuals are fine since instantiated.
Frame:44 - Instantiate - RectTransform.sizeDelta:(500.00, 0.00)
Frame:45 - RectTransform.sizeDelta:(315.76, 19.00)
Frame:46 - RectTransform.sizeDelta:(315.76, 31.93)
Frame:47 - RectTransform.sizeDelta:(315.76, 31.93)
Frame:48 - RectTransform.sizeDelta:(315.76, 31.93)
Frame:49 - RectTransform.sizeDelta:(315.76, 31.93)
Object 2:
Frame:115 - Instantiate - RectTransform.sizeDelta:(500.00, 0.00)
Frame:116 - RectTransform.sizeDelta:(315.76, 19.00)
Frame:117 - RectTransform.sizeDelta:(315.76, 31.93)
Frame:118 - RectTransform.sizeDelta:(315.76, 55.86)
Frame:119 - RectTransform.sizeDelta:(315.76, 55.86)
Frame:120 - RectTransform.sizeDelta:(315.76, 55.86)
This is the logs for 2 objects instantiated by the system. When instantiated the sizeDelta is the one at the prefab even though I already set the text before logging. Then it takes several frames to reach the stable sizesDelta, the Y is the automatically calculated value, X is set directly after instantiation.
Any ideas how I can have that deltaSize at the same time I instantiate the objects? because I need that value to position them properly before any animation on them.
Cheers.