Trying to make a respawn function but it is not working.
I am trying to make it so if my player hits a cube with the tag "Kill" it "repsawns", but this is not working and is not erroring at all:
void Respawn() %|1496774173_1|% gameObject.transform.position = spawnPoint; }
spawnPoint is simply a Vector3 and I call my function like this:
void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Pick Up")) { other.gameObject.SetActive(false); count = count + 1; SetCountText(); audio.Play(); if (count >= 16) { wintext.text = "You win!"; } } else if (other.gameObject.CompareTag("Kill")) { Respawn(); } }
What am I doing wrong?
Are you sure the collision is detected ?
Are you sure the tag is exactly "$$anonymous$$ill" (and not "kill" or something else....)
Are you sure the Respawn function is called ?
Your answer
Follow this Question
Related Questions
convert java to c# 1 Answer
What happens when you Instantiate a GameObject? 1 Answer
Checking if index of Vector3 array matches integer with if statement? 0 Answers
Photon Networking - How to move all players from game scene to current room scene? 0 Answers
Lose Health when GameObject enters collider? (OnTriggerEnter) 2 Answers