public void OnTriggerEnter2D(Collider2D collider) { GameUnitEntity unit = collider.GetComponent <GameUnitEntity>(); if (unit != null) { if (this.owner != unit.owner) { unit.owner.removeCaptureEntity(this); unit.owner.setCapturedEntity(this); } unit.dir = this.dirValue; } }