private void OnTriggerEnter2D(Collider2D other) { if (other.transform.tag != "player") { if (other.transform.tag == "good") { e = other.gameObject.GetComponent <enemy>(); e.change(good); } if (other.transform.tag == "bad") { e = other.gameObject.GetComponent <enemy>(); e.change(bad); } } }