Safe Zone from enemy

In my game I have a sphere collider that I want to be a “safe zone”. Basically I want the player to be able to go within the collider but I want the enemy to collide with the sphere so that it cannot get the player while he’s inside it. I’ve tried several OnTriggerEnter & onCollisionEnter functions that I’ve found on this site for the safe zone but none of them have been successful.

An easy solution is to use Physics.IgnoreCollision() between the player and and the collider for the ‘safe zone’. If the enemy will continually try and get at the player, it is possible he can make it into the ‘safe zone’. There are a lot of question on UA about repeatedly driving against a collider resulting in an object getting through. If you have this problem, search UA for the solution(s).

As an alternate, it is possible to use layers to determine what collides with what:

http://docs.unity3d.com/Documentation/Components/LayerBasedCollision.html

Why don’t you set the layer of the collider so that it only blocks enemies? That would work if your enemies use physics to move around.

Set the layers up so enemies collide with the safe zone but that the player doesn’t.