SendMessage call:
gameInstance.SendMessage("MessageReceiver", "Test", "This is a message", "myname");
Error message:
Failed to call function Test of class MessageReceiver
Calling function Test with 1 parameter but the function requires 2.
(Filename: Line: 810)
And the function definition:
public void Test(string message, string name) {
// If the call from JavaScript succeeds, an alert will show up on the page
Application.ExternalEval("alert('it works')");
}
The first parameter, "MessageReceiver", is the unity game object the script is attached to.
The second one, "Test", is the name of the function being called.
The rest of the parameters are passed to the called function, in my case, "Test".
As you can see, I'm passing 2 string parameters, which is exactly what "Test" receives. Why then is an error telling me that I'm calling the function with 1 parameter? Any help would be appreciated.