Restrict character's movement within a level's map

Hi everyone !

I’m making a level and using a First Person Controller as my character. However, I want to limit my character’s movement within the level boundary, which is a plane. I don’t want him to go beyond the limit and fall from there, I just want him to be stopped there by an invisible wall. Is there anyone who can help me with this problem ? Thank you in advance !

There are a few ways to do this. Firstly, you could add a box collider to an empty game object, and stretch that however you like. Then there are more complicated ones, like this:

    transform.position.x=Mathf.Clamp(transform.position.x,0, 100);
	transform.position.z=Mathf.Clamp(transform.position.z,0, 100);

There are many more ways in between, as well however.