OnTriggerEnter - Same collider triggers multiple times?, is size a factor?

I have a collider set as a trigger on my moving rigidbody, which is the size of the rigidbody. I have another trigger, which detects when my rigidbody goes through, and prints the name of the rigidbody collider.

When the rigidbody collider enters the trigger, it prints the rigidbody’s name more then once (up to 5 times). But if I reduce the size of the rigidbody collider so that it’s much smaller then the trigger checking for it, it only prints the name once.

Does the size of the other collider matter? If the collider entering the trigger is bigger then said trigger, is it going to detect the collision more then once?

Thanks for your time!
Stephane

This is a problem i recently had and asked about and was asked before here is the link to the answer. “Edited from here.” here is the chunk of code i have been using with the most up to date version of unity and it seems to be working fine.

function OnTriggerEnter(col : Collider){

if(col.tag == "waypoint" && !isTriggered ){
	isTriggered = true;
	ChangeWayPoint();
	
}

}

function ChangeWayPoint(){

if(waypoints != 11){
	curWayPoint ++;
	isTriggered= false;
	print(curWayPoint);

I had a similar problem today. It turned out I somehow had two "Circle Collider 2D components attached to the offending object. Removing the extra one via the inspector got rid of the extra onTriggerEnter.

In my case the problem was that both colliders (player and enemy) was flagged as “IsTrigger”, this way enemy collider fire OnTriggerEnter, then in the same time player collider also fire OnTriggerEnter. To solve that i just set the player flag “IsTrigger” to false.

Here is the definitive solution i found to this problem:

void OnTriggerEnter(Collider enemy) {
    enemy.hitCount++;
    if(enemy.hitCount==1){
        enemy.doStuff();
    }
}

void OnTriggerExit(Collider enemy) {
    enemy.hitCount--;
    if(enemy.hitCount<0){
        enemy.hitCount=0;
    }
}

In this case go to the enemy script and add the variable:

public int hitCount=0;