So I've got a collider that's checking for the tag of the game object that enters it. If both a green and ref tag enter it I want to call a separate function.
I have it working for individual game objects but I'm having problems with multiple. This is all happening inside a OnTriggerEnter2D.
I'm not getting any errors with it but the debug.long never prints so the collider isn't seeing the gameobjects.
Thanks in advance! :)
else if (trigCol.name == "Yellow Trigger")
{
if ((collision.CompareTag("greenBlock")) && (collision.CompareTag("redBlock"))) // If the tag of the colliding object is greenBlock
{
Debug.Log("Inside yellow trigger. This is the " + collision.tag + " tag");
YellowBlock();
}
else if (collision.tag == "blueBlock")
{
Debug.Log("Incorrect block!");
wrongSound.Play();
currentScene = SceneManager.GetActiveScene();
SceneManager.LoadScene(currentScene.name);
}
}