GetMouseButtonDown From a close distant

So i have a button and it can be clicked from anywhere. My question is how can I make it clickable when player is in range like 1 meter or something. Here is my script :
using UnityEngine;
using UnityEngine.UI;
using System.Collections;

 public class ButtonOnClickActive : MonoBehaviour {
     public GameObject canvas;
     public AudioClip search;

    private bool clicked;

    void OnMouseOver()
       if(Input.GetMouseButtonDown(0) && !clicked)
          clicked = true ;
          GetComponent<Renderer>().material.color =;

Change the if statement to include a distance check.

Example :

if (Input.GetMouseButtonDown(0) && !clicked && Vector3.Distance(transform.position, player.transform.position) < 1f)
    //do stuff