If trigger hit, spawn at location

Hi, I am trying to make a game where the player hops along pillars till he reaches the other side, if the player falls off, I want it to where it instantly teleports him back to the starting zone

Im guessing i would need a trigger for the floor where if a player hits, and a place for the player to spawn, i just dont know how i would go about coding it.

Any help would be greatly appreciated!

You must create the trigger object - a plane or cube stretched to cover the area, and with Is Trigger checked. Create also an empty object and move it to the teleport destination, at some height above the ground (2 or 3 units), and rotate it to align its Z axis to the desired forward direction.

Attach the script below to the trigger, and drag the destination empty object to the variable dest in the Inspector; if you want to make a sound effect when teleporting, define the sound in the variable sound:

var dest: Transform; // drag the destination object here
var sound: AudioClip; // define a teleport sound, if you want

function OnTriggerEnter(other: Collider){
  if (other.tag == "Player"){
    // move the player and align it to the dest object:
    other.transform.position = dest.position;
    other.transform.rotation = dest.rotation;
    // if some sound defined, play it at the destination:
    if (sound) AudioSource.PlayClipAtPoint(sound, dest.position);

Something like this ?
Make sure the player has a rigidbody and collider, and the deathzone has a trigger collider:

var spawnPoint : Transform; //drag your spawn point to here in the Inspector - probably make it an empty gameobject so you can move it around
// var spawnPoint : Vector3 = Vector3(0, 10, 0);

function OnTriggerEnter(other : Collider)
	if (other.gameObject.tag == "Player")
		other.transform.position = spawnPoint.position;
		// other.transform.position = spawnPoint; // fixed vector method

try searching this 'site for ‘trigger respawn’ : http://answers.unity3d.com/search.html?redirect=search%2Fsearch&q=trigger+respawn

Here is something that should work:

//specify the starting position as a vector3
var startingPosition : Vector3

//when the player collides with something
function OnTriggerEnter(other:Collider)
	//check if player collided with the ground by checking the collider's tag
	//Be sure to specify the tag for the ground object
	if(other.tag == "ground")
		//move the player to specified starting position
		transform.position = startingPosition;

Alternatively, instead of using a collider, you could just check when the character’s y position is below a certain number like -10 or something, then move him to startingPosition.

Good Luck.

I know a perfect way to make that happen without a trigger and without complicated scripting go to this 5. Shadows & Respawn - MAKE A GAME (Unity) - YouTube