NullReferenceException when using PhotonNetwork.AuthValues??
Options
So, I attempted to do custom authentication from this thread: http://forum.exitgames.com/viewtopic.php?f=17&t=2697. 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";
PhotonNetwork.ConnectUsingSettings("Tst");[/code2]
}
It returned a NullReferenceException on the line that had the 'PhotonNetwork.AuthValues.AuthType"
Is this a bug or am I doing something terribly wrong?
Thanks,
Daft
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";
PhotonNetwork.ConnectUsingSettings("Tst");[/code2]
}
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?
Thanks,
Daft
0
Comments
-
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.0 -
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]0