private void OnCollisionEnter(Collision collision) { Spider hitSpider = collision.gameObject.GetComponent <Spider>(); if (hitSpider == null) { return; } hitSpider.Die(); }