void Start() { ec = parent.GetComponent<enemyController>(); //make a new box collider that's the size of parent objects (the enemy) current one attackArea = GetComponent<BoxCollider2D>(); Vector2 newSize = new Vector2(parent.GetComponent<BoxCollider2D>().size.x * 3/4, parent.GetComponent<BoxCollider2D>().size.y); //offset is used to make sure the new collider is facing in front of the object offset = 1; if (ec.facing()) offset = -1; Vector2 newOffset = new Vector2(attackArea.size.x * offset, 0.0f); attackArea.size = newSize; attackArea.offset = newOffset; }