void OnTriggerEnter2D(Collider2D other) { if (other is CircleCollider2D) { GameObject obj = other.gameObject; BallStuff bs = obj.GetComponent <BallStuff>(); if (bs == null) { Destroy(gameObject); } } else { Destroy(gameObject); } }
void OnTriggerEnter2D(Collider2D other) { //collision with the goal net if (other is PolygonCollider2D) { pc.DecreasePlayerScore(value); Destroy(gameObject); } else if (other is CircleCollider2D) { GameObject obj = other.gameObject; BallStuff bs = obj.GetComponent <BallStuff>(); if (bs != null) { Destroy(gameObject); } } }