How to prevent player from going out of the map

I’m making a 2.5D style game with a similar design to Pokemon. I coded my character movement but the problem is that my character can simply walk of the edge. I want it to be similar to Pokemon games when you are indoors. There is a wall that prevents you from going outside except where the door is located. I don’t really know how to recreate that effect because I can’t really use colliders since my character doesn’t have a rigidbody. Any ideas are appreciated. Thanks !

Hi, I’m quite new to Unity, but in 2D can use Mathf.Clamp method to clamp movement between certain areas this is standard way to do it. Example from my current project:

void Update () {

churchPos = churchTrans.position;
zipSpeed = baseSpeed * Time.deltaTime;

if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow)) {
    float yChurch = churchPos.y - zipSpeed;
    churchPos.y = Mathf.Clamp(yChurch, -25f, 25f);
}

Here -25f and 25f are the limits for this background image to move, otherwise will look as if player has fallen off. Look up mathf.clamp in https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html also
If your character moving in both x and y planes, or at angle to the planes, you may need to clamp separately in both. If this doesn’t work, you can try posting your current movement code I think. 2.5D usually means you move within 2 dimensions only but 3D background objects, assume that is what you mean also.