NullReferenceException when using PhotonNetwork.AuthValues??

So, I attempted to do custom authentication from this thread: I have a fully set up PHP script to do the authentication, but there is a problem:

When this code is called,
[code2=csharp]void Start() {
Debug.Log (CustomAuthenticationType.Custom); //This returns 'Custom'

PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.Custom; //Nullreferenceexception here!!! Wat?
PhotonNetwork.AuthValues.AuthParameters = "username=test&password=test";

It returned a NullReferenceException on the line that had the 'PhotonNetwork.AuthValues.AuthType"
NullReferenceException: Object reference not set to an instance of an object
debugNetwork.Start () (at Assets/debugNetwork.cs:9)

Is this a bug or am I doing something terribly wrong?


  • Also, I am using Unity 5. When the package was imported, it wanted me to 'update' it. This may be the reason.

    Also, I'm using 64bit Unity 5. Also been having other non-related issues.
  • I fixed it by adding this line at the top. Doh. Kind of makes sense now...
    [code2=csharp]PhotonNetwork.AuthValues = new AuthenticationValues(); //DUH lol[/code2]