Something strange (or stupid) is going on...

I have an interface which has 4 different implementations (the Protocol interface), SingleDevice, BlueTooth, Networked, and SmartFoxServer classes.

In each of the 4 above classes, I have a function called SetUpMatch(…).

I am working on the SmartFoxServer class, and I have no idea what is going on.

	    Debug.Log("SETUP MATCH!!!");
	    currentProtocol.Test();
	    Debug.Log("A "+currentProtocol.GetName());
	    currentProtocol.MessageSetUpMatch(value1,value2,value3,value4);
	    Debug.Log("PPPPPPPPPPPP");

In my function I see “SETUP MATCH” get displayed in the debug.
Test() just prints out the name of the protocol I am using (and it does so correctly)
Then I see “A SmartFoxServer” get displayed.
Then the call to MessageSetUpMatch() just seems to get lost in outerspace. The first line in the function is Debug which never gets printed.
“PPPPPPP” never gets printed.

There is no crash, no errors.

If I remove all of the parameters in MessageSetUpMatch in the declaration, call, and implementation, it seems to work (but I need the parameters!).

There are quite a few parameters, and I have implemented the code in Javascript-- is there something strange going on here? (would you be able to tell more if I posted more?

Further testing seems to point at something is foul with the Argument count.

I commented out all but one parameter, and it worked. I commented out only one parameter and it failed.

I’ve seen something strange like this in PERL with a null reference. Maybe the Unity Compiler is doing something funny?

AHHHHHH!

It’s driving me nuts!!!

The only thing I can do now is actually show the offending code; Let me show you 3 examples:

function HandleConnection ()
{
	    Debug.Log("SETUP MATCH!!!");
	    currentProtocol.Test();
	    Debug.Log("A "+currentProtocol.GetName());
	    currentProtocol.MessageSetUpMatch(int.Parse(entries["cupStyle"].ToString())/*,int.Parse(entries["numberOfPlayers"].ToString()),int.Parse(entries["playerReracks1"].ToString())/*,int.Parse(entries["playerReracks2"].ToString()),int.Parse(entries["playerReracks3"].ToString()),int.Parse(entries["playerReracks4"].ToString())/*,int.Parse(entries["playerAIDifficulty1"].ToString()),int.Parse(entries["playerAIDifficulty2"].ToString()),int.Parse(entries["playerAIDifficulty3"].ToString()),int.Parse(entries["playerAIDifficulty4"].ToString()),boolean.Parse(entries["playerIsHuman1"].ToString()),boolean.Parse(entries["playerIsHuman2"].ToString()),boolean.Parse(entries["playerIsHuman3"].ToString()),boolean.Parse(entries["playerIsHuman4"].ToString())*/);

	    Debug.Log("PPPPPPPPPPPP");
}

---------

interface Protocol
{
    function MessageSetUpMatch (cupStyle : int/*, numberOfPlayers : int, playerReracks1 : int/*, playerReracks2 : int, playerReracks3 : int, playerReracks4 : int/*, playerAIDifficulty1 : int, playerAIDifficulty2 : int, playerAIDifficulty3 : int, playerAIDifficulty4 : int, playerIsHuman1 : boolean, playerIsHuman2 : boolean, playerIsHuman3 : boolean/*, playerIsHuman4 : boolean*/) : void;
}

--------------

    function MessageSetUpMatch (cupStyle : int /*,numberOfPlayers : int, playerReracks1 : int/*, playerReracks2 : int, playerReracks3 : int, playerReracks4 : int/*, playerAIDifficulty1 : int, playerAIDifficulty2 : int, playerAIDifficulty3 : int, playerAIDifficulty4 : int, playerIsHuman1 : boolean, playerIsHuman2 : boolean, playerIsHuman3 : boolean/*, playerIsHuman4 : boolean*/)
    {
	Debug.Log("SENDINGSmartFox!");
//	gameRules.SetUpMatch(cupStyle, numberOfPlayers, playerReracks1, playerReracks2, playerReracks3, playerReracks4, playerAIDifficulty1, playerAIDifficulty2, playerAIDifficulty3, playerAIDifficulty4, playerIsHuman1, playerIsHuman2, playerIsHuman3, playerIsHuman4);
	Debug.Log("SENDING222!");
//	Send(PackData(["SetUpMatch",cupStyle.ToString(),numberOfPlayers.ToString(),playerReracks1.ToString(),playerReracks2.ToString(),playerReracks3.ToString(),playerReracks4.ToString(),playerAIDifficulty1.ToString(),playerAIDifficulty2.ToString(),playerAIDifficulty3.ToString(),playerAIDifficulty4.ToString(),playerIsHuman1.ToString(),playerIsHuman2.ToString(),playerIsHuman3.ToString(),playerIsHuman4.ToString()]),"Others","TCP");
    }

The above works and prints out “PPPPPPPPPP”.

The below does NOT work:

[code]
function HandleConnection ()
{
	    Debug.Log("SETUP MATCH!!!");
	    currentProtocol.Test();
	    Debug.Log("A "+currentProtocol.GetName());
	    currentProtocol.MessageSetUpMatch(int.Parse(entries["cupStyle"].ToString()),int.Parse(entries["numberOfPlayers"].ToString()),int.Parse(entries["playerReracks1"].ToString()),int.Parse(entries["playerReracks2"].ToString()),int.Parse(entries["playerReracks3"].ToString()),int.Parse(entries["playerReracks4"].ToString()),int.Parse(entries["playerAIDifficulty1"].ToString()),int.Parse(entries["playerAIDifficulty2"].ToString()),int.Parse(entries["playerAIDifficulty3"].ToString()),int.Parse(entries["playerAIDifficulty4"].ToString()),boolean.Parse(entries["playerIsHuman1"].ToString()),boolean.Parse(entries["playerIsHuman2"].ToString()),boolean.Parse(entries["playerIsHuman3"].ToString()),boolean.Parse(entries["playerIsHuman4"].ToString()));

	    Debug.Log("PPPPPPPPPPPP");
}

---------

interface Protocol
{
    function MessageSetUpMatch (cupStyle : int, numberOfPlayers : int, playerReracks1 : int, playerReracks2 : int, playerReracks3 : int, playerReracks4 : int, playerAIDifficulty1 : int, playerAIDifficulty2 : int, playerAIDifficulty3 : int, playerAIDifficulty4 : int, playerIsHuman1 : boolean, playerIsHuman2 : boolean, playerIsHuman3 : boolean, playerIsHuman4 : boolean) : void;
}

--------------

    function MessageSetUpMatch (cupStyle : int ,numberOfPlayers : int, playerReracks1 : int, playerReracks2 : int, playerReracks3 : int, playerReracks4 : int, playerAIDifficulty1 : int, playerAIDifficulty2 : int, playerAIDifficulty3 : int, playerAIDifficulty4 : int, playerIsHuman1 : boolean, playerIsHuman2 : boolean, playerIsHuman3 : boolean, playerIsHuman4 : boolean)
    {
	Debug.Log("SENDINGSmartFox!");
//	gameRules.SetUpMatch(cupStyle, numberOfPlayers, playerReracks1, playerReracks2, playerReracks3, playerReracks4, playerAIDifficulty1, playerAIDifficulty2, playerAIDifficulty3, playerAIDifficulty4, playerIsHuman1, playerIsHuman2, playerIsHuman3, playerIsHuman4);
	Debug.Log("SENDING222!");
//	Send(PackData(["SetUpMatch",cupStyle.ToString(),numberOfPlayers.ToString(),playerReracks1.ToString(),playerReracks2.ToString(),playerReracks3.ToString(),playerReracks4.ToString(),playerAIDifficulty1.ToString(),playerAIDifficulty2.ToString(),playerAIDifficulty3.ToString(),playerAIDifficulty4.ToString(),playerIsHuman1.ToString(),playerIsHuman2.ToString(),playerIsHuman3.ToString(),playerIsHuman4.ToString()]),"Others","TCP");
    }

Anyone have any ideas?

I’m thinking of switching the protocol just before the offending code to see what happens… otherwise I think I’m out of ideas.

So, it seems that int.Parse(myString) is not throwing errors-- I assume this is normal and my fault due to ignorance?