Line 17 of my code is returning an error

superluigi430
edited June 2015 in Photon Chat
#pragma strict

import ExitGames.Client.Photon.Chat;
//public class ChatGUIScript extends MonoBehaviour//, IChatClientListener (I don't know how to write this in unityScript, but I get the feeling it's necessary)


var chatAppId : String;
var chatClient : ChatClient;
var userName : String;

function Start ()
{
	DontDestroyOnLoad(this.gameObject);
    Application.runInBackground = true;
    
        
    chatClient = new ChatClient(this);//THIS IS THE PROBLEM LINE
	chatClient.Connect(chatAppId, "1.0", userName, null );
}

function Update ()
{
	print(userName);
	
	if (this.chatClient != null)
    {
    	this.chatClient.Service();
    }
    
    else
    print("chatClient equals null");//This gets printed because line 17 isn't working
}

This is the error I get: InvalidCastException: Cannot cast from source type to destination type.
ChatGUIScript.Start () (at Assets/Scripts/ChatGUIScript.js:17)

Comments