Does anyone know exactly how the ComputeApproximateSize() function works? I'd like to dynamically resize a UI Panel based on the text it contains, but I can't figure out a way to get a size for the text. So far the best I've managed is to get ComputeApproximateSize() to return nil. Is there a working example of the function anywhere?
You need to wait for it for a few frames. To do that, use a while loop to check if the size is nil
.
local size = text_obj:ComputeApproximateSize()
while(size == nil) do
Task.Wait()
size = text_obj:ComputeApproximateSize()
end
-- Size should now contain the approx size.
Thank you! Exactly what I was looking for.