What is the simplest way to let an unspecified script get a variable from another script?

With unspecified i mean modular.
I want to create a reusable button which can open a door or do something else. If i check the button bool in the door update it would check for it every frame and not only when the button is pressed. I can’t send it from the button because it would work only for a specific script.

I found out myself. For anyone interested:
I just used a UnityEvent and which then can invoke any function on any script on an object.
Like this:

public UnityEngine.Events.UnityEvent UseableObjects;

public void Use()
	{
		UseableObjects.Invoke();
	}

The Use function is called by the Player script and defined by a raycast.

I like this very much because i can invoke several objects at once. Unity is awesome.

Is there a more efficient way to to this?