How to get the height of a gameobject at a given point ?

Hi, I have a big gameObject which act as a big map.

I want to create an invisible TileMap for this object but I can’t find a way to get the y coordinates at a random x and z coordinates.

I already know the function Terrain.SampleHeight(). Is there an equivalent for other gameObjects?

Thanks in advance.

Assuming “big gameObject” means a MeshRenderer and Mesh component, then you could use the Renderer.bounds property to get the bounding volume of a renderer object. You could also loop through Mesh.vertices, convert them to world space with Transform.TransformPoint and pick the highest y-value.