How to make the enemy only start pathfinding when player is within certian distance

Im using A* pathfinding and unity 2d. Also im very new and dont really know how to code well so if you can tell me the code it would be much appreciated. I figured out how to use A* but i dont want the enemy to constantly follow my player every where