- Home /
Collision2D error when instantiating a prefab.
alt text
I am creating a 2D game and currently am having an issue with a boxcollider 2D where its boxcollider is working when it's in the game, but when i Instantiate the boxcollider 2D it says there is an issue with it. I believe that there is an issue with the orientation when instantiating it, but when I fix it the Box colliding still does not work.
Currently the only thing i need this box to do is collide with an object and destroy it but the collider is just no registering.
All objects have 2Dcollider's and Rigidbody2D's attached
current script for the box collider 2D
void OnCollisionEnter2D (Collision2D col) { if (col.gameObject.tag == "Enemy") { Destroy(gameObject); Destroy(Enemy); } }
Ensure that it isn't a Trigger. And where is Enemy Defined in your project.
Answer by dysonarama1 · Jul 13, 2017 at 04:41 AM
never mind, all sorted now. had to change from a bullet to a circle collider 2d. for some reason it wasn't registering the rotation of the box collider.