Unity acts like it's not receiving extentions

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

GRIM2594
Posts: 52
Joined: 07 Nov 2010, 23:16

Unity acts like it's not receiving extentions

Postby GRIM2594 » 23 Nov 2010, 06:24

I have stumbled onto an issue, and don't know where to turn next... I was wondering if any one knows what may cause my issue...


Earlier today, I was creating extensions for my game. I was running tests, with a working system... Everything was working great, and then all of the sudden my server computer crashed and restarted itself.

Ever since the crash, my Unity Client does not receive the data sent through the extensions. (Nothing was changed in the code, at all, to cause this.)

What I have done to try to fix the issue:

- Reinstalled Smartfox 2x / Unity3D
- Replaced the .dll plugin for SmartFox, into Unity assets.
- Checked network settings (ports ect)
- Software settings
- (re)Scripted my entire client-side code, with bare minimum to work
- (re)Scripted my extensions

Nothing seems to "re-enable" what was working prior to the crash.

The custom login system continues to work though, which is odd because they are all in the same .jar file... (lol) It checks the database for correct login name and password, and it seems unaffected.

(Client and server computer are different boxes.)

Also note, when the server crashed: it locked up my Unity client so I had to do a force shutdown with CTRL+Delete->End process.

The Smartfox server trace shows that the data is being processed, and it "says" that it is sending the data (through a trace).

Any help would be great.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 23 Nov 2010, 11:33

Did you upgrade to rc1a SFS2X server? rc1 had that bug with responses not being send

/Thomas
GRIM2594
Posts: 52
Joined: 07 Nov 2010, 23:16

Postby GRIM2594 » 23 Nov 2010, 13:31

ThomasLund wrote:Did you upgrade to rc1a SFS2X server?


Yeah, I did. I am a big fan of staying up to date! (hehe)


My first thoughts were that I skrewed something up with my code, because I was changing it around; testing new things... But I have brought it down to the bare basics to work, and still nothing.

I have debug/traces on all of the steps in the program, and I can follow it; but the client simply does not receive the data.

Is there a way that I could check to see if this line of code is actually sending data?

Code: Select all

this.send("myExtension", objectToClient, sender);


I have a trace before and after it, both say that the data is "there" to be sent; and I am assuming that it IS triggering because of the execution of the trace afterwards.
GRIM2594
Posts: 52
Joined: 07 Nov 2010, 23:16

Postby GRIM2594 » 23 Nov 2010, 15:26

Let me post the small bit of code that I am using, to see if any of you can find a flaw that I am simply not seeing myself.

extension handler:

Code: Select all

addRequestHandler("myExtension", myExtension.class);


extension:

Code: Select all


public void handleClientRequest(User sender, ISFSObject params)

   trace("Sent...");
   ISFSObject objectToClient = SFSObject.newInstance();
   objectToClient.putInt("numbers", 12345);
   objectToClient.putUtfString("text", "ThisIsATest");
   this.send("thisExtension", objectToClient, sender);
   trace("Sent... objectToClient: " + objectToClient);
}


receiver script in Unity3D:

Code: Select all

smartFox.AddEventListener(SFSEvent.EXTENSION_RESPONSE, OnExtensionResponse);


Code: Select all

private void OnExtensionResponse(BaseEvent evt)
    {
        try
        {
            cmd = (string)evt.Params["cmd"];
            ISFSObject someParam = (SFSObject)evt.Params["params"];

            if (cmd == "thisExtension")
            {
                Debug.Log("thisExtension returned...");

                numbers = someParam.GetInt("numbers");
                text = someParam.GetUtfString("text ");
                Debug.Log("Data received: numbers = " + numbers + "  and text = " + text);
            }
        catch (Exception e)
        {
            Debug.Log("Exception handling response: " + e.Message + " >>> " + e.StackTrace);
        }
        Debug.Log("Something was caught ...");

    }


I know that sometimes I will capitalize a letter somewhere, that will screw everything up... But I don't see any place that anything like this is occurring in this small amount of script.
GRIM2594
Posts: 52
Joined: 07 Nov 2010, 23:16

Postby GRIM2594 » 23 Nov 2010, 16:29

As an update...

I created a new Unity project, re-wrote some basic extension receiver script; and it triggers the event.

So some where in my other code, is a flaw. I will have to look harder, I suppose...

Thanks, for the help though!

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 66 guests