Reference variable in other script


I have an object that the player must hit, the object needs to be hit 3 times for something to happen, I want to be able to have several of these objects in my scene.

The problem I am having is referencing this hit value from another script.

The object I am hitting has a script to detect collisions, while another object has the scripts that are controlling its behaviour. I need to be able to get the hit counter from the collisions script.

This is covered in the docs:

make that variable as public static.
in another script acees though classname.varname