OnPlayerConnected ... The message will be ignored.

I copied the following code from the unity docs here:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    private int playerCount = 0;
    void OnPlayerConnected(NetworkPlayer player) {
        Debug.Log("Player " + playerCount + " connected from " + player.ipAddress + ":" + player.port);

However, without making any modifications, it gives the following error:

Script error: OnPlayerConnected
This message parameter has to be of type: NetworkPlayer
The message will be ignored.

I’m entirely confused. Is there some setup I need to do?

Ok I realised the problem. I had my own class called NetworkPlayer that was clobbering the NetworkPlayer that the method was expecting. I changed the name of my class (this was the easiest option).

I really should take the error messages literally, it’s easy to think you know better than the machines, but we don’t; Skynet will become self aware!