void OnTriggerEnter(Collider other) { PlayerCharacter player = other.GetComponent <PlayerCharacter>(); if (player != null) { // print("hit"); player.Hurt(damage); } enemy2 zombie = other.GetComponent <enemy2>(); boss boss = other.GetComponent <boss>(); WanderingAI reptile = other.GetComponent <WanderingAI>(); if (zombie != null) { ReactiveTarget target = zombie.GetComponent <ReactiveTarget>(); print("child found"); zombie.transform.Find("blood").gameObject.active = true; // the code here is called // for each child named Bone target.ReactToHit(); } else if (reptile != null) { print("reptile hit"); ReactiveTarget target = reptile.GetComponent <ReactiveTarget>(); target.ReactToHit(); } else if (boss != null) { boss.hurt(10); } Destroy(this.gameObject); }