OnCollisionEnter() not working in Unity3D

I have an object with a mesh collider and a prefab with sphere collider. I want the instance of the prefab to be destroyed if the two collide. I wrote the following in a script: But it is not working. I have tried toggling isTrigger on both the objects.

C# 2D platformer movement code

There are a couple of ways to achieve this but following your current implementation: why not set the isGrounded flag to false when you jump and just let the trigger handle resetting the flag when you land? Some things you could check: Are all your colliders 2D and set to be triggers?Have you checked your … Read more

Unity OnTriggerEnter2D not registering

There are four things I can think of which need to happen so that OnTriggerEnter gets called: The two objects’ colliders need to actually be overlapping. Just because their rendered pixels are overlapping, doesn’t mean their colliders are overlapping. This can be checked in the editor. Their colliders are indicated with a green outline in the Scene tab. If … Read more

Getting mouse position in unity

I’m trying to move a object to the mouse position. But it’s giving me large x value like 300 but at that place the pre placed object’s x position is -4. So how can I get the current mouse position? Thank you..

What Language is Used To Develop Using Unity

As far as I know, you can go with c#. You can also use the obscure language “Boo”. (Found at https://boo-language.github.io/) In the past (before about 2012) it was possible to use a strange variant of Java but that is now deprecated and does not work. Note that Unity builds to Android / iOS, and … Read more