Event based Waiting?

So I am in a bit of a dilemma. Basically I need to do a bunch AABB checks but they are inaccurate because my UI hasnt changed its size yet when i set its vertex data. I have to wait for it to be updated by ui grid layout. Problem is I only know how to do wait() and even with game:GetService("RunService").Heartbeat:Wait() it still was super slow. I tried doing this hacky thing where I would basically increment a value and check its modulo and then wait, but it proved to be too unstable for commercial use. So what should I do? How would I yield the thread or maybe predict? Where it’s size and position should be? Isn’t there like some hidden function like UIGridLayout:Wait() that I just dont know of?

Here is a in-game example just to prove my point…

1 Like

So basically you are just trying to pause it until the ui is completely populated through the use of uigridlayout if i’m not mistaken?

1 Like

So I am trying to either pause it until its been updated by the uiGridLayout or try and predict its future position and size. That’s my options I can think of. I am trying to pause it for each pixel so it can “load in” in a sense as I know for sure it isnt taking milliseconds to load in.

1 Like

Maybe you could make a custom object to avoid using uigridlayout completely, to mimic the behavior of it. I had to do something similar for my customizable ui system.

That is one option I was thinking too but I want a more streamlined approach. I’ll keep this idea in mind and try and fiddle with the maths

I dont really see any other good option. You might be able to get away with using some kind of recursive function using a conditional check than return true or something once that condition is met.

idk why none of you guys said “just wait then check again bro”. Anyways that worked out.