public void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag(explodeOnTag)) { Explode(); Fracturable fracturable = collision.transform.parent.GetComponent <Fracturable>(); if (fracturable != null) { fracturable.Fracture(); } } }
void Start() { fracturable = GetComponent <Fracturable>(); }