Unity3d detect when closer than 10?

Hello. How can i get a detection for a rts camera when i am closer than 10 like vector3.distance to something then it would do something?

You could use a sphere collider set up as a trigger, and handle the outcome within OnTriggerEnter: Unity - Scripting API: Collider.OnTriggerEnter(Collider)

Or you could keep a list of objects you are interested in, and periodically check their distance from the camera:

if (Vector3.Distance(cameraPosition, objectPosition) <= 10.0f)
{
// Do a thing.
}