Problem with accessing static variables

Hi. I’m using a GameObject called References, containing a script with the same name, which contains references to other GameObjects which are activated and deactivated during gameplay. Now, I’m having problems with referencing the static variables within the References script. The error I get is:

Assets/Scripts/CharacterSelection.cs(43,87):
error CS0176: Static member
`References.playerRef’ cannot be
accessed with an instance reference,
qualify it with a type name instead

and the erratic code looks like so:

private GameObject playerRef;

void Start () {
		playerRef = GameObject.Find ("References").GetComponent<References>().playerRef;
	}

The References script looks like this (the value of the variable is assigned elsewhere):

public static GameObject playerRef;

I’ve been googling for help on static variables, but all I can find is how to work with static methods. If anybody could give me a pointer on what I’m doing wrong, it would be really helpful.

Ok so, instead of finding an Instance, you can refer straight to the class itself. so you would do References.playerRef; Static variables are on their own, a single instance and the way you access them is by referring to the base class, rather than finding an instance of the class within the scene. They are help separately outside of instances.

C# Global Variable Examples - Dot Net Perls might help a bit more with this issue.