An Array of a class

I have a class defined as:

class PlayerXClass
  {
  public float[] LevelScore = new float[12];
  public int TotalScore, PlayerHand;
  }

This is defined before “MonoBehaviour {“

How do I now get an array of “4” Players from this, I tried this:

PlayerXClass[]   PlayerX = new PlayerXClass[5];

Which is located after “MonoBehaviour {“, but before “Awake()”

Then I define an instance in “Awake()” as:

PlayerX[1].TotalScore = 0;

MonoBehaviour compiles the program with no errors but Unity gives the error “NullReferenceException: Object reference not set to an instance of an object Initialize_Multiplayer.Awake () (at Assets/Initialize_Multiplayer.cs:43)”

// Declare it
PlayerXClass[] PlayerX = new PlayerXClass[4];

// Before you use it, you need to create it
PlayerX[0] = new PlayerXClass ();
PlayerX[0].TotalScore = 0;

ooohh, thanks…