I am working with a Unity game developer, and some part of his game requires us to pass the session data to the game in order to get the right user in the game. Unfortunately, every time I tried to pass the data using the docs he provided, I keep encounter the error “Failed to call function LoginSuccessful of class NetworkManager, Calling function LoginSuccessful with 1 parameter but the function requires 3.”.
He gave me the function parameters and the data type I should follow, but somehow it still returns the same error. I would need the community guidance on this matter.
Unity Game Function
public void FunctionA ( int A, int B, string token ) {
}
My JS Script
var a = 1;
var b = 1;
var c = '8d4a7d1a-69cc-40f9-a74e-0fa7b388fbc6';
var script = document.createElement("script");
script.src = loaderUrl;
var MyGameInstance = null;
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {
progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => {
MyGameInstance = unityInstance;
loadingBar.style.display = "none";
MyGameInstance.SendMessage('NetworkManager', 'LoginSuccessful', a, b, c);
fullscreenButton.onclick = () => {
unityInstance.SetFullscreen(1);
};
}).catch((message) => {
alert(message);
});
};
Error message when the game loads:
Failed to call function LoginSuccessful of class NetworkManager
Calling function LoginSuccessful with 1 parameter but the function requires 3.