hello everyone
i am new to programming and game development and its not so clkear to me what is the difference between OnCollitionEnter2D and OnTrigerEnter2D and when to use each of them…
it would be nice if you can explain it to me please
Welcome to our community, and thank you for your question!
The difference between OnCollisionEnter2D and OnTriggerEnter2D is simple: They are two different methods, hence the different names. Furthermore, they are Unity methods. This means that there is already functionality behind these methods. We did not write that functionality ourselves.
In our game, a trigger collider is a collider which has got “Is Trigger” enabled in the component in the Inspector. OnCollisionEnter2D gets invoked automatically if one of the colliders in a collision event is a non-trigger collider. OnTriggerEnter2D gets invoked automatically if one of the colliders in a collision event is a trigger collider. The “Enter” indicates that the event gets triggered if two colliders “enter” one another. For further information, please refer to the manual.
thank you for your help
this is helped me to understand why we need this 2 methods and when to use each one of them.
and thank you for the really quick replay