- Home /
What are some reasons my gameObject isn't colliding?
I believe I have the code right--what are some reasons besides the code that it wouldn't be checking for collisions? Both objects have a collider attached and the object in question has a rigidbody. What are some other reasons it wouldn't be detecting collisions?
If ya' really want to know, the code has an onCollisionEnter function that sets a Boolean to a value--it's just not detecting and firing the function.
Answer by guido-paglie · Sep 01, 2017 at 06:58 PM
Hi ! If one gameobject has a collider (OBJ 1), and the other gameobject has both collider and rigidbody 2D (OBJ 2), you are starting right.
When you do play, OBJ 2 is stoping or crashing with OBJ 1? if not, maybe one of the colliders is disabled, or maybe there aren't really touching in any moment. if yes. Maybe the OBJ 2 doesn't have the script ? Or you can have a typo, copy this:
void OnCollisionEnter (Collision col) { Debug.Log("Hi !"); }
I hope it helps, cheers !
Your answer
Follow this Question
Related Questions
Can you trick a Ui Button that it is being clicked with code? 3 Answers
Collition help 1 Answer
OnParticleCollision Not Working? 0 Answers
Unity not recognising Destroy() 2 Answers
JavaScript - Reset Characters Position 2 Answers