Using OnDrawGizmos to measure the max y height of all child objects

I was using the solution in this post: How to measure the height of 3D objects. - Questions & Answers - Unity Discussions

It works really well but I had no idea Gizmos wouldn’t work in the actual game build as I am pretty new to C# and Unity.

In my game the player stacks gambeobjecs on top of one another. They are able to go very high, move in 3D space, and the objects are able to fall, lowering the max height.

What is a solution that works as well as the gizmo script I linked that works in the actual game build?

This is what you can use to draw boxes on the screen: