"Drag and drop" reference a variable in another script (float, integer)?

In Unity you can assign a reference by dragging and dropping in the inspector. Is there a way of mimicking this type of functionality, but for referencing a variable in another class?

For example, say I have a generic GUI Gameobject with a script that controls the size of a slider using a float value. This one script could be used to represent health, but also armor, energy, or any other kind of float-based variable in the game.

Is there a way of making an instance of this generic GUI script “reference” float variables in other script instances without having to explicitly know the type of the object it is referencing variables from?

Please tell me if my question or terminology is unclear. Thanks.

If what I understand is correct, you may be better off creating another component script that gets the values from the gameobject’s script and handles them accordingly. Essentially a bridge between your “unknown” values and your UI components.