Vector3.Distance - Triggering an action on distance

Hello All!
I`m working on a project of mine, and i feel kind of lost.
Here is the scenario:
I have a player who walks around, and some Cube objects around him.
I want to measure the distance between the player and the objects, and when the player gets close enough to any of the objects then trigger a popup window saying “Press X button to do Y”.

Now on every object i have a - public float minDist;
and also - public float currDist;
Obviously I`m using: Vector3.Distance to measure the distances between the player and the objects,
and set currDist by it.

When currDist is lower when minDist I want the trigger to happen, but for some reason i found that only 1 object sets the trigger and not all of them…

Any ideas please?


public float minDist;
public float currDist;

void Update () {

    currDist = Vector3.Distance (transform.position, Player.transform.position);
    		if (currDist < minDist) {
    			//Enable Trigger
    		else if (currDist > minDist){
    			//Disable Trigger 


This will be because all of the items are running at the same time, and whilst one object will run, enable the trigger, and carry on, another item will immediately say “I’m too far away” and disable the trigger again.

IO would suggest storing a value in the objects, when they enable the trigger, something like “ResponsibleForTrigger” and only let them disable the trigger, if this flag is set. In other words any object can enable the trigger, but only an object that has enabled the trigger can disable it.

Hope this makes sense.