Failed to call function.

I have 10 elements from 0 to 9, when I do this script, I get an error at runtime;

Failed to call function checkViewList of class PlanetMenu.
Call function checkViewList with no parameters but the function requires 1.

if (currentSystemM == "Galaxy"   ) Camera.main.SendMessage("checkViewList", 0);

void checkViewList(int goVisit){
// My codes are here
}

All numbers are accepted, but not “0”, but my elements start with 0. My first element is Galaxy 0, 2nd is Galaxy 1 etc.

When I add this short line it works, but what is the difference, it’s still 0.

var Button = 0;
if (currentSystemM == "Galaxy"   ) Camera.main.SendMessage("checkViewList", Button);

Is there anyway I can still use “0” without using “var button = 0;”? It accepts any number except 0, is it a bug in unity?

If you’re not using SendMessage to call the method on multiple differing types of scripts you can call the method directly.

if (currentSystemM == "Galaxy")
    Camera.main.GetComponent<PlanetMenu>().checkViewList(0);

This calls the method directly without using reflection. It is faster than using SendMessage. And you get more error checking at compile time.