I’m trying to make a match3 game, and based on how i’ve implement it, every time a tile changes position, it’ll try to group up with any similar colored tiles it’s now adjacent to. However, this also means I need to make it ungroup from them. Is there any way to check all collisions simultaneously to determine that none have the same tag? I’d want to do something like
private void OnCollisionExit(Collider2D[4] other)
{
if(other[0].gameObject.tag != this.gameObject.tag && other[1].gameObject.tag != this.gameObject.tag && other[2].gameObject.tag != this.gameObject.tag && other[3].gameObject.tag != this.gameObject.tag)
{
this.transform.parent = null;
}
}
But I’m not sure if that would work, as the standard collision functions only check one collision at a time, and I can’t think of a good way to keep track that none of them have been the same type/tag as the current tile.