I'm learning unity, and I'm trying to recreate a game of my in Unity from XNA.

I'm following this Tutorial Playlist from unity on youtube, and I've used the GameManager and BoardManager to create my map.

This is my inspector on the wall prefabs



And this is the inspector on my Player prefab



The code for the PlayerMovement script

using UnityEngine; namespace Assets.Scripts { public enum Directions { Back, Left, Front, Right, Idle = -1 } public class PlayerMovement : MonoBehaviour { #region Public Members public float speed; #endregion #region Constants private const float DECAY_FACTOR = 0.85f; private const float SPEED_FACTOR = 20000f; #endregion #region Private Members private Rigidbody2D rb2D; private Vector2 velocity; private Animator animator; #endregion #region Game Loop Methods private void Awake() { animator = GetComponent<Animator>(); rb2D = GetComponent<Rigidbody2D>(); } private void Update() { float vertical = Input.GetAxisRaw("Vertical"); float horizontal = Input.GetAxisRaw("Horizontal"); UpdateVelocity(vertical, horizontal); UpdateAnimation(); UpdateMovment(); } #endregion #region Animation Methods private void UpdateAnimation() { Directions direction; if (velocity.y > 0) direction = Directions.Back; else if (velocity.y < 0) direction = Directions.Front; else if (velocity.x > 0) direction = Directions.Right; else if (velocity.x < 0) direction = Directions.Left; else direction = Directions.Idle; SetDirection(direction); } private void SetDirection(Directions value) { animator.SetInteger("Direction", (int)value); } #endregion #region Movement Methods private void UpdateMovment() { Debug.Log(string.Format("HOR - {0} : VER - {1} : DIR - {2}", velocity.x, velocity.y, animator.GetInteger("Direction"))); transform.Translate(velocity.x, velocity.y, 0f, transform); ApplySpeedDecay(); } private void UpdateVelocity(float vertical, float horizontal) { if (vertical != 0) velocity.y += Mathf.Abs(speed) / SPEED_FACTOR; if (horizontal != 0) velocity.x += Mathf.Abs(speed) / SPEED_FACTOR; } private void ApplySpeedDecay() { // Apply speed decay velocity.x *= DECAY_FACTOR; velocity.y *= DECAY_FACTOR; // Zerofy tiny velocities const float EPSILON = 0.01f; if (Mathf.Abs(velocity.x) < EPSILON) velocity.x = 0; if (Mathf.Abs(velocity.y) < EPSILON) velocity.y = 0; } #endregion } }

Here's an example of my problem ingame:

As you can see, the player can simply move in and out of walls as if they don't have box collider.