Two Polygon2D Collider do not Collide with Each Other (Solved)

I am making a game where objects fall from the up side to bottom and my character will collect them when they touch it. Both objects and character have polygon collider. Update “Also both have rigidbody2D”

The thing is the collision is working fine, objects can hit to my character. The problem is I can not use this collision in my code.

void OnCollisionEnter2D(Collision2D col){

		if(col.gameObject.name == "character"){
			caughtByCharacter ();
		}

	}

	void OnTriggerEnter2D(Collider2D col){
		
		if(col.gameObject.name == "character"){
			caughtByCharacter ();
		}

	}

Both of the collision and trigger does not work. What is the problem? Is it because of polygon collider’s rules?

**Thanks for all replies. When tanoshimi mentioned the character name I figure out my problem. Actually it is not about the gameobject name. Something happened because of my carelessness.

I have wrote that collision code inside the spawner not the objects falling. Sorry for bothering you all with it.**

Collisions won’t be registered unless at least one of the colliding objects has a rigidbody2d component.

Thanks for all replies. When tanoshimi mentioned the character name I figure out my problem. Actually it is not about the gameobject name. Something happened because of my carelessness.

I have wrote that collision code inside the spawner not the objects falling.