Best way to maintain a list of selected objects? (Static Classes?)

I was wondering what the best way to maintain some selected options or game states. That doesn’t really explain it very well. Let me give you an example.

Lets say I’m building an RTS game. Say have 2 buildings, a factory and a refinery. There are 2 gui buttons to reflect this. When I click factory it sets the ‘buildingToBuild’ variable to a GameObject of the factory. When I click on the ground to place the factory, it places the factory and then nulls the buildingToBuild variable. Now when I click on the building it sets the ‘selectedBuilding’ variable to the factory game object.

does that make sense? I would like the buildingtobuild and selectedbuilding to be accessible by all classes. I was thinking that I could have a ‘GameVars’ class that contained static variables.

Would this be an acceptable way to approach this problem or would this create more problems for me down the road?

What I see is you needing a call reference. For example, I do a lot of JS. So at the bottom I’d add:
@Script RequireComponent (name) //This is the main controller
@Script AddComponentMenu (srclocation/“filename”) // This is the script in question
You can have as many scripts attached as you like to each object. You need one main script for the building and then the 2 selection scripts your having issues with attached and called upon on selection. That’s the simplest way I know how to explain it.