How to keep an object from leaving the edge of the screen?

I would like to keep a player controlled object from going off the edge of the screen(all other objects are allowed to though). I’ve tried adding 4 long box colliders where the egde of the screen should be but it’s hard to get exact, not to mention that the edge of the screen can change with different aspect ratios, etc…

Does anyone have any suggestions? I would prefer to have the object slide along the edge like if the collider property was set to ice.

Thanks

One thing you could try would be to use Camera.ScreenToWorldPoint() or Camera.ScreenPointToRay() to compute the four points where the frustum edges intersect the plane in which the game takes place; this will give you a rectangle in world space, which you can then use to position your colliders correctly.