Prefab not colliding with player object

I’m working on a simple 2D game where you control a space ship that can only move left or right, and if you collide with one of the falling asteroids the game ends. Currently, I have polygon collider set up on my ship, as well as my asteroids prefab. When I spawn the asteroids, it just makes a clone of the asteroids. When I start the game, I set out the prefab in the hierarchy (just to test) and it’s able to collide with the ship, but the clones do not. I’ve inspected the properties of the clones and they do have the polygon collider attached to them so they should be colliding but but they’re just passing right through.

Any ideas on what else I could be looking for? It’s probably something simple, but I can’t figure out what’s going on.

Do all the objects have rigidbody?

Yes, they both have the rigid body component attached to it. I also checked the asteroid prefab clones that are being spawned to see if they have the same properties attached to it and it does. I’ve attached a screen shot of what I’m talking about in case I’m not making clear sense.

You have set it to be a trigger which is wrong

2 Likes

Aha! That seemed to do the trick. I knew it was something simple I was over looking. Thank you!

I’m having the same problem by player and enemy both have box collider 2d and ridgidbody 2D, they aren’t is triggers and they don’t collide. Any ideas?

Are they on the same Z-axis coords?

I would like to inform you about this as it may help someone. Your object might not collide because you might use a .fbx instead of a prefab. In my case, this was the issue.