# How to calculate the distance from the camera to make a GameObject fill the screen?

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.