make it appear and then do distance and if too close destroy it and make it appear again and so on ?
Yes, this is a good idea. Thank.
But it will not be optimized.
By the way, if you do such a check, it will destroy all the enemies that will approach the player