Using custom classes in an array get Null Exception error. I know its been asked before, still cant get it working...

Hey all,

So this is my code:

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class GameController : NetworkBehaviour{

public class PlayerReference{

	public float playerID;
	public int playerNumber;

}

private float[] playerID;
private int[] playerNumber;

private PlayerReference[] players;

// Use this for initialization
void Start () {

	playerID = new float[4];
	playerNumber = new int[4];

	players = new PlayerReference[4];

	for (int i = 0; i < players.Length; i++)
	{
		//players *.playerID = 0f;*

_ //players .playerNumber = 0f;_
//Debug.Log (“Players[” + i + "] has a playerID and playerNumber of " + players_.playerID + " and " + players*.playerNumber);
playerID = 0f;
playerNumber = 0;_

Debug.Log (“Players[” + i + "] has a playerID and playerNumber of " + playerID _+ " and " + playerNumber);
}
}*_

* // Update is called once per frame*
* void Update () {*

* }*
* public int AssignPlayerNumber(float randomID)*
* {*
* for (int i = 0; i < players.Length; i++)*
* {*
_ //if (players .playerID == randomID) {
if(playerID == randomID){
* return 0 ;
}
}
for (int i = 0; i < players.Length; i++)
{
//if (players .playerID == randomID)
if(playerID == 0f)
{
//players .playerID = randomID;
playerID = randomID;
//players .playerNumber = i + 1;
playerNumber = i + 1;
//return players .playerNumber;
return playerNumber;
}
}
return 0;
}
}*

Basically, whenver I use the PlayerReference lines (currently commented out) I get the Null Reference Exception. But I can’t see how. I’m declaring it in the script Start() as “new PlayerReference[4]” which is the correct declaration for arrays. This works with GameObject, so why not this custom class? I really don’t get this…
I know this has been asked before, but nothing really answers my questions… could just be that I’m WWWAAAYYY too tired and not seeing it, lol. Any ideas?
When I’m using the different, separate arrays (float and int) it works fine. But this is, of course, messy…
P.S. I’ve tried it with an actual constructor (and yes I remove the Start() section’s entries) but I still get the same problem. Is there something else I’m supposed to do to a class to be able to make it into an array?_

You need to instantiate new classes. Add players *= new PlayerReference();to the Start function’s for-loop.*
[Classes (C# Programming Guide)][1]
[1]: Classes | Microsoft Learn