global variable need advice

can global variables be used for all objects in the hiearchy?

for exapmle, can you make something like:

global var x=0

and use that same variable in a different script for a different game object? i just need a yes or no. thanks.

You can access variables in other scripts yes.

var someValue = someGameObject.GetComponent.<SomeScript>().someVariable;

or if you need a class variable:

var someValue = SomeClass.someClassVar; //Class var is a `static` var