C# :
My main script :
void OnTriggerEnter(Collider other)
{
if(gameManager.GetComponent("Lab").SendMessage("Check",other))
{
// The things I'm going to do right after I solve this issue.
}
}
“Lab” script :
bool Check(Collider other)
{
if (other.transform.tag == "object_A")
return true;
else
return false;
}
But Unity gives an error saying " Cannot implicitly convert type ‘void’ to ‘bool’ ".
Unity doesn’t seem to let me return values between scripts. Maybe it’s because SendMessage method does not receive values. How can I manage to return a value from a method that’s in another script?
I don’t want to use bools and send messages back because my main script will be attachted to at least 10 objects. I want to do it in a simple way. Thanks in advance!