public void OnTriggerEnter(Collider coll) { if (coll.gameObject != roomObject && destoryPositionIfUnavaliable && coll.gameObject.tag != "Player") { if (parent.index < coll.gameObject.transform.parent.GetComponent <RoomClass>().index) { Destroy(coll.transform.parent.gameObject); } } else if (!destoryPositionIfUnavaliable) { parent.Deactivate(index); gameObject.SetActive(false); } }