void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("RoomSpawnPoint")) { RoomController adjRoom = collision.transform.parent.gameObject.GetComponent <RoomController>(); adjRoom.AddAdjacencies(needOpening, transform.parent.GetComponent <RoomController>().distance + 1); RoomController room = transform.parent.gameObject.GetComponent <RoomController>(); room.adjacentRooms.Add(collision.transform.parent.gameObject); room.AddDoor(needOpening, doorSpawn); Destroy(gameObject); } }