Question by
Whelandrew · May 23, 2020 at 07:12 PM ·
rigidbody2doncollisionenterboxcollider2d
OnCollisionEnter2D not responding from runtime?
I have a building object that stays in place. It has a RigidBody2D and a BoxCollider2D. I have an object that moves towards it. This object has a BoxCollider2D.
When they collide, the OnColliderEnter2D function should be calling on the moving object? Did I set this up correctly?
I am loading these objects in runtime through a script that loads the objects positions on the screen. Could that be detaching them?
Comment
Answer by Whelandrew · May 24, 2020 at 05:39 PM
Okay! So the layout I explained above WILL work. Somehow, I stopped adding my collider to the moving object in script. Everything is back to normal now.
Your answer
![](https://koobas.hobune.stream/wayback/20220612235103im_/https://answers.unity.com/themes/thub/images/avi.jpg)