So, today I want to share with you the script in C# and updated to the last Unity version (5.4) at this time:

/*
*
* Base script was created by an user called BrettFromLA from Unity forums.
* I have updated the code to the last Unity version (5.4) and translated the code
* from JScript to C#.
*
* You can see the way of use this code on my post: http://blog.growthlikes.com/2016/09/invisible-boundaries-walls-script-in.html
*
* Original code by: BrettFromLA (http://forum.unity3d.com/threads/invisible-boundaries-walls.45044/)
* Updated and translated to C# by: Nauta Dev (https://nautadev.blogspot.com)
*
*/