Ian H.
Ian H.

Reputation: 3919

Unity Wall Elements in 2D RPG

I am trying to create a top-down viewed 2D RPG. But sadly I am already failing at creating movement-impairing walls. Here are the components of the player (char) and the wall:

But now if I try to run into the box collider of the wall element I dont get blocked as I expected. What am I doing wrong?

Edit: updated the image

Upvotes: 0

Views: 3323

Answers (1)

Paweł Marecki
Paweł Marecki

Reputation: 630

You need to add collider to your character, because collisions can be crecognized between two colliders. Also, there is no need to put Rigidbody2D on Wall, Unity requires Rigidbody2D on one of collided objects, so if you have Rigidbody2D on Character there is no need to got it on wall too.

Upvotes: 1

Related Questions