Detect specific collider's collision

I have a player with multiple colliders on it. Is there a way to only take input from one of the colliders without having to move it to another gameobject?

Unfortunately not, but you can accomplish half of what you want here by having a reference to the parent script from each child’s scripts to call a method from the parent script when the child colliders collide with something. This way all of your collision logic is handled in one place, rather than separated into multiple scripts.
Example:

public class ParentScript : MonoBehavior {
   public void HandleCollision(Collision collision) {
      //Etc...
   }
}
public class ChildScript : MonoBehavior {
   private ParentScript parentScript;

   void Start() {
      parentScript = transform.parent.GetComponent<ParentScript>();
   }

   void OnCollisionEnter(Collision collision) {
      parentScript.HandleCollision(collision);
   }
}
5 Likes

Ok thanks

Wait, so im having a similar issue. I have a series of colliders placed over my airplane model, all these colliders are under an empty game object. I placed the ChildScript to each collider and the ParentScript to the main object. However, i t doesn’t seem to work. What am i doing wrong?

There are limitless possibilities. Are you getting an error message?

No errors, its just that the collisions are not being detected by the colliders on the plane and therefore not deducting health from the parent_health_Script., However the bullet objects are being destroyed on collision like they are supposed to.