Respawn with enemy contact

Hi all, I am a complete beginner at unity with a limited knowledge of coding, I am making a simple maze game and using this tutorial >> http://dma.canisius.edu/~moskalp/tutorials/FollowPlayer/followPlayer.mov have made an object that Im using as the enemy to follow the Player when they get within a certain distance.

I then watched this tutorial Unity 3D Tutorial Part 2: Basics of coding. - YouTube where he shows how you can make the player respawn when they enter the cube but when I make my cube object “OnTrigger” It falls straight through the ground.

My plan is to make the enemy object respawn the player at the beginning of the maze when they catch up with the player and touch them but I’m getting confused and was wondering if anyone had any suggestions, they would be greatly appreciated thanks!

From what i read i think you probably checked IsTrigger what results in ´the object falling through the ground.

You should use a script and probably tags. This is how i would do it.

Make a script and attach it to the players object and write something like this in it:

function OnCollisionEnter(collision : Collision)
{
if(collision.gameObject.tag=="enemy")
   {
      //Here RespawnScript like for example: gameObject.transform.position=Vector3(0,0,0);
   }
}

Then you have to set the tag of the enemy Objects to enemy. Btw. the script is not perfect and you may have to tweak it if you need help with it or if its not working comment and i’ll help you or someone else does.

Hope this works.