Unity -- setting an entire sprite as a walkable area.

I’ve been sort of trying my own thing but it’s super buggy so I’d like to see what other people have done to create moveable spaces. In essence, I just want to restrict my character’s movement to inside of a sprite. So one of my sprites is the character and another one of my sprites is a box – I want to make it so my character can’t leave the box. I’ve been modifying transform.position on mouse click in order to move my character, but now I’m not sure if this was the smartest idea.

Well regarding restricting the movement to the box, why not just add a box collider that surrounds the box, and add a rigidibody to your character, this would make him hit the collider but not be able to go through it so it’s restricted to that areas.