unity 2d float distance between two objects code example
Example: how to compare distance between 2 objects unity
float distance = Vector3.Distance (object1.transform.position, object2.transform.position);
float distance = Vector3.Distance (object1.transform.position, object2.transform.position);