Make sure you have declared the function in the correct scope.
Message functions cannot be called if they are local functions.
public class Example : MonoBehaviour
{
void Update()
{
// This is a local function.
// Don't put your function inside of another.
void MessageFunction()
{
...
}
}
// This is the correct scope for message functions.
void MessageFunction()
{
...
}
}