How to solve the situation?

0 votes

I imported plugins in unity for AppWarp, and I am able to connect to server and get all the events as it should.

Once There was a problem in connection at the time when attempt connect to server was being made, and there was following exception occured and no "OnConnectDone" callback called...

NullReferenceException: Object reference not set to an instance of an object
com.shephertz.app42.gaming.multiplayer.client.WarpClient+<execute>d__3.MoveNext ()

com.shephertz.app42.gaming.multiplayer.client.WarpClient+<WaitForRequest>d__0.MoveNext () 

 

asked Sep 9, 2015 in Work In Progress by devang024 (15 points)
edited Sep 10, 2015 by devang024
Appwarp initialization

void Start ()

    {
        WarpClient.initialize(apiKey,secretKey);
        WarpClient.GetInstance().AddConnectionRequestListener(listen);
        WarpClient.GetInstance().AddChatRequestListener(listen);
        WarpClient.GetInstance().AddUpdateRequestListener(listen);
        WarpClient.GetInstance().AddLobbyRequestListener(listen);
        WarpClient.GetInstance().AddNotificationListener(listen);
        WarpClient.GetInstance().AddRoomRequestListener(listen);
        WarpClient.GetInstance().AddZoneRequestListener(listen);
        WarpClient.GetInstance ().AddTurnBasedRoomRequestListener (listen);

    }

OnConnectDone implementation

public void onConnectDone(ConnectEvent eventObj)

        {
            Log ("onConnectDone : " + eventObj.getResult ());

            switch( eventObj.getResult() )
            {
                case WarpResponseResultCode.SUCCESS:
                if (Application.loadedLevelName == "Login")
                {
                    appwarp.SharedInstance.setUserCustomData( Facebook.MiniJSON.Json.Serialize(  Parameters.UserCustomData) );
                    NGUIEvents.SharedInstance.ConnectionState.text ="Connected to Server.";
                    GameObject gameSelectionSceneObject = GameObject.FindWithTag("LoginMainTable");
                    LandingPage demoscript = gameSelectionSceneObject.GetComponent<LandingPage>();
                    if ( demoscript != null )
                    {
                        demoscript.changeToLobby();
                    }
                    
                }
                break;
                
                case WarpResponseResultCode.AUTH_ERROR:
                    if (Application.loadedLevelName == "Login")
                    {
                        NGUIEvents.SharedInstance.ConnectionState.text ="Authentication error occured.";
                        ParseAPIInterface.SharedInstance.getUsername();
                        
                    }
                    break;

                case WarpResponseResultCode.BAD_REQUEST:
                    if (Application.loadedLevelName == "Login")
                    {
                        NGUIEvents.SharedInstance.ConnectionState.text ="Server response:Bad Request.";
                        NGUIEvents.SharedInstance.TryAgainButton.SetActive(true);
                    }
                    break;
                case WarpResponseResultCode.UNKNOWN_ERROR:
                    if (Application.loadedLevelName == "Login")
                    {
                        NGUIEvents.SharedInstance.ConnectionState.text ="Unknown error occured..try again later.";
                        NGUIEvents.SharedInstance.TryAgainButton.SetActive(true);
                    }
                    break;
                case WarpResponseResultCode.CONNECTION_ERR:
                    if (Application.loadedLevelName == "Login")
                    {
                        NGUIEvents.SharedInstance.ConnectionState.text ="Connection Error occured..try again later.";
                        NGUIEvents.SharedInstance.TryAgainButton.SetActive(true);
                    }
                break;
                    
                case WarpResponseResultCode.CONNECTION_ERROR_RECOVERABLE:
                    
                    if ( Application.loadedLevelName == "GameSelection" )
                    {
                        GameObject gameSelectionSceneObject = GameObject.FindWithTag("");
                        DemoScript demoscript = gameSelectionSceneObject.GetComponent<DemoScript>();
                        
                    }

                    break;
                
            

            }

            if (NGUIEvents.SharedInstance!=null)
            NGUIEvents.SharedInstance.changeToGuestIdleState ();
        }



Just found that if you want to regenerate the exceptions, cut the connection in-between "OnConnectDone" to be called and "connect to server" method is once called, then this will reoccure most times in my case atleast.

Please ask anything furthur is required from my part
Hi Devang,

We are looking into this error and update you soon.

Thanks & Regards
Sumit Balodi
Appwarp Support Team

1 Answer

0 votes

Hi Devang,

 

Can you please share your code snippet of Appwarp inititalization, Connect and onConnectDone  methods? 

It will help us to debug the problem.

Also, it would be good if you could share the source of this error, within your script.

Let me know if you face any problem.

 

Thanks & Regards,

Sumit Balodi

Appwarp Support Team

answered Sep 10, 2015 by sumit.balodi (40 points)
Hi Devang,

Could you please check the same with this new SDK :

https://dl.dropboxusercontent.com/u/115918533/AppWarpUnity.dll

If you are still facing issue, please feel free to contact us.

Thanks & Regards,
Sumit Balodi
Appwarp Support Team
I downloaded and tried with new DLL file
I got following...

NullReferenceException: Object reference not set to an instance of an object
com.shephertz.app42.gaming.multiplayer.client.WarpClient.initialize (System.String apiKey, System.String pvtKey)
appwarp.Start () (at Assets/Scripts/LoginScreen/appwarp.cs:51)

and it traced back to this "WarpClient.initialize(apiKey,secretKey);" call.

Moreover , when I checked WarpClient Gameobject,it had NULL monobehavior (script was missing from Monobehavior Component and showed NULL ), while I re-checked with old DLL it had WarpClient script to same monobehavior
Script attacthed.
Thanks
Hi Devang,

I downloaded the same dll from the link I've provided to you and it is working at my end.
Could you please check this project - https://dl.dropboxusercontent.com/u/115918533/New%20Unity%20Project.zip
It is a sample project, where the same downloaded dll is attached.
Also, I think it would be good, if you could share your sample project with us, to help you support in better way.

Thanks & Regards,
Sumit Balodi
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...