GameObject[] doorsLeft = GameObject.FindGameObjectsWithTag(c_doorLeft);
GameObject[] doorsRight = GameObject.FindGameObjectsWithTag(c_doorRight);
List<GameObject> allDoors = doorsLeft.Union(doorsRight).ToList();
for(int i = 0; i < allDoors.Count; i++)
{
if(allDoors[i].transform.parent.name != "Wall_Door_Long_01" && allDoors[i].transform.parent.name != "Wall_Door_Long_02")
{
allDoors.RemoveAt(i);
}
}
foreach(GameObject door in allDoors)
{
Debug.Log("Door Parent : " + door.transform.parent);
}
If it's not "Wall_Door_Long_01" and not "Wall_Door_Long_01" then remove the item from the list.
After that when I'm doing a loop on the allDoors again and debug log the parents I see that some of the parents are not "Wall_Door_Long_01" and not "Wall_Door_Long_02" but after removing they all should be only "Wall_Door_Long_01" or "Wall_Door_Long_02"
Maybe the comparison is wrong ?