OnTriggerEnter2D 함수가 동작하지 않는 이유
OnTriggerEnter2D 의 공식 문서를 보면 다음과 같은 설명을 볼 수 있다.
Description
Sent when another object enters a trigger collider attached to this object (2D physics only).
Further information about the other collider is reported in the Collider2D parameter passed during the call.
This message is sent to the trigger Collider2D and the Rigidbody2D (if any) that the trigger Collider2D belongs to, and to the Rigidbody2D (or the Collider2D if there is no Rigidbody2D) that touches the trigger.
Note: Trigger events are only sent if one of the Colliders also has a Rigidbody2D attached. Trigger events are sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.
결론: 여기서 Note 부분을 보면 trigger를 통해 충돌하는 두 물체중 하나가 Rigidbody2D를 갖고 있어야 한다는 내용을 확인할 수 있다.
출처: https://discussions.unity.com/t/why-isnt-my-ontriggerenter2d-function-working/89227
https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnTriggerEnter2D.html