What is the different between OnTriggerEnter and OnCollisionEnter ?

Im new on programing and I start like it so i need to know some thing , and how to make the OntriggerEnter work with any colldier ?

Hi There @Hajamat

Y’know, in times like these it’s really best to go and consult the Scripting API provided by Unity themselves. Especially if you’re new to the engine and programming in general. So, I’ll paste the links to relevant pages in the scripting API below.

OnTriggerEnter - Scripting API

OnCollisionEnter - Scripting API

Now, as for the question. The difference between the OnTriggerEnter method and the OnCollisionEnter method is stated in their names.

OnTriggerEnter - Is called whenever an object with a collider has passed through an object with an “isTrigger” checked collider. For example, if you were to make a box trigger and the player walked through it, that would fire the OnTriggerEnter method on that object.

OnCollisionEnter - Is called whenever an object with a collider has collided with another object that contains a collider. For example, if two cars were to crash into one another, that would fire the OnCollisionEnter method on both of those objects.

I hope this helps! :slight_smile:

A collision also contains information about physics and affects the physics (like mentioned car crash), while a trigger won’t affect physics directly and can be handled like an event (in instance when the player reached a certain point xyz shall happen).