How to implement a score

How can I implement a score? What kind of variable can I use in order to increment it from anywhere in my game?
I can think of a public variable at class level in one of my game´s classes and then instantiate such a class from other parts of my game to get access to that variable, but I wonder if this is a good approach.

Regards,
Jorge Maldonado

You could also just use a static variable if you only need to store one single score in your whole game.

Or, as you suggested yourself, you create a class that holds all the information such as score etc as a public field or property (whatever you’d like to have) and then reference this instance in each script you want to manipulate the score or any other attribute.