deleting child objects in gridlayoutgroup not refreshing it

so i deleted some child objects from a gridlayout group and also did a layoutrebuilder.forcerebuildlayoutimmediate for that group BUT when i check how many childs the transform has, it is still showing the same!

how can i make sure that my deleting of the child objects will not be reflected when i check for childs?

BUT when i check how many childs the transform has, it is still showing the same!

Did you checked amount of children during the same frame when you called Destroy () for them?
If so, make note that Destroy () does not delete object instantly. It delete object at the end of this frame.

You may use DestroyImmediate (), it will delete everything instantly, but Unity do not recommend to use it because it is dangerous, since it can delete assets from project folder and also it may cause strange behavior in some cases.

If you need to avoid this problem, you may keep your children in array, and after you delete every object in array - clear this array.
However I am not sure about your situation. If it does not solve a problem, explain it in more details.