GetComponent = null Fix?

Hello and I am trying to load a character into a game scene by instanciating a new player:

GameObject newPlayer = (GameObject)Instantiate (PlayerObj, PlayerLoadUpdatePosition, new Quaternion ());

But when I try to load him, I get a null reference exception. The line of code that has the nullreference is

newPlayer.GetComponent<Player>().Load (PlayerLoadUpdateName, PlayerLoadUpdateInfo, PlayerLoadUpdatePosition);

More Specifically the thing that is null is:

GetComponent<Player>()

How do I make this not null?

You make it not be null by making sure the object actually has the component attached that you’re trying to get. If GetComponent returns null, the only thing that ever means is that the component you’re attempting to get is not there. It really is just that simple and there’s no way around it. If you think it is there, then you’re mistaken about one of these things: which object you’re actually referring to, the name of the component, or (if you’re mixing C# with Unityscript) script compilation order.

OK guys I found the issue. In the Player prefab, the one that PlayerObj is accessing, it didn’t have the Player.cs script attached. When I added it then I have no errors and everything worked fine.