두 콜라이더가 접촉하면 프로젝트에서 다른 이벤트를 트리거하는 데 사용할 수 있는 함수를 호출합니다. 이러한 함수에 원하는 코드를 배치하여 충돌 이벤트에 응답할 수 있습니다.
콜라이더 이벤트는 C# 스크립트를 통해 설정해야 하며, 사용자 인터페이스만으로는 설정할 수 없습니다.
콜라이더 이벤트 타입에는 두 가지가 있습니다.
Collider.OnCollisionEnter
, Collider.OnCollisionStay
및 Collider.OnCollisionExit
등이 있습니다.Collider.OnTriggerEnter
, Collider.OnTriggerStay
및 Collider.OnTriggerExit
등이 있습니다.Is Trigger가 활성화된 콜라이더를 트리거 콜라이더라고 합니다. 트리거 콜라이더는 다른 콜라이더와 물리적으로 충돌하지 않으며, 대신 다른 콜라이더가 통과할 때 이벤트를 전송하는 공간을 생성합니다.
참고: 2D 물리 시스템에는 이름에 2D가 추가된 대응하는 함수가 있습니다(예: OnCollisionEnter2D
). 이러한 2D 함수에 대한 자세한 내용은 MonoBehaviour
API 클래스 기술 자료를 참조하십시오.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.