JavaScript communication with SendMessage and an int parameter that equals 0

I have a problem.

If I have a parameter that equals “0” and it does a conversion that it thinks I’m not passing any parameter and it fails:

Application.ExternalEval(“SendMessage("Example", "TestMethod", “JSMethodThatReturnsZero()”);”);

MissingMethodException: The best match for method TestMethod has some invalid parameter.

// Unity side
void TestMethod(string parameter) {
}

I think is the same problem that when on Unity side we do:

SendMessage(go, “MethodName”, null);

We can’t pass “null” because is the same as no parameters.

The only workaround I see is to pass it as string and doing a cast on Unity side.

just from the syntactic looks of it, shouldn’t it be more something along the lines

Application.ExternalEval("SendMessage("Example", "TestMethod", " + JSMethodThatReturnsZero() + “);”);

or even

SendMessage(“Example”, “TestMethod”, JSMethodThatReturnsZero());

??

It was a manually typed example.

I’m talking that passing an argument with 0 for Unity it expects a method with no arguments.

This sounds like a bug. Could you file a bug report with a repro case? Then we will take a look.