How do I keep the angle of a box?

I have a cube I want to use as my 2d character in a platform game.

I want to make it so that the rotation of the cube NEVER changes so that when a slope comes along he will fall down without falling to the left or right.

I assume your cube has a rigidbody assigned? Rigidbodies have a property "freezeRotation" that prevents them from being rotated by the physics engine.