I try to create a script generated dungeon. If a corridor runs alongside a room, all tiles on the adjacent wall are replaced by archways. This is not intended.
Thanks for your help!
The part where I want to destroy only one wall tile:
GameObject wallToDestroy = null;
Collider[] colliders = Physics.OverlapSphere(doorPosition, 1f);
bool wallDestroyed = false;
foreach (var collider in colliders)
{
if (collider.gameObject.tag == "Wall" && !wallDestroyed && collider.transform.position == doorPosition)
{
wallToDestroy = collider.gameObject;
Destroy(wallToDestroy);
wallDestroyed = true;
break;
}
}
GameObject door = Instantiate(doorPrefab, doorPosition, doorRotation);
door.name = $"{doorName}_{roomID}";
}