How do you calculate the distance from the camera so that a GameObject fills the screen? I.e. Without reaching out of the view and regardless of screen orientation.
You can return the difference of
transform.position of Main Camera and
transform.position of GameObject, if you only want the distance between them.
If you want something else, I think this video might help you