This question was
closed Apr 11, 2017 at 01:28 PM by
CosmicSloth.
Question by
CosmicSloth · Apr 10, 2017 at 05:04 PM ·
3drespawnspawnpointsrespawning
Respawn System Not Working
All I want to do is set up a system where the player collides with an invisible cube beneath the map (tagged as respawn) and spawns back at a spawn point (tagged as spawnPoint) but what I have now isn't working. Do I have to include the camera also as the camera is attached to the character?
using UnityEngine;
using System.Collections;
public class respawn : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider other)
{
if (gameObject.tag == "respawn");
{
transform.position = "spawnPoint";
}
}
}
Comment
Answer by JustinEllis · Apr 10, 2017 at 05:14 PM
Make sure that you have whatever the player is colliding with marked as a trigger. As well make sure you have if(other.gameObject.tag == "respawn") not gameObject.tag
Follow this Question
Related Questions
Respawn doesn't work ? 0 Answers
VR respawn only works once 1 Answer
fpscontroller doesnt respawn (maybe transform.position issue?) 0 Answers
[SOLVED]How do I spawn GameObject[] in Transform[]? 2 Answers