Using Else on OnTriggerStay, do a game over if i click when i dont have a box on it the collidor/mesh.
This is my current script, but i don't know how to do a "gameover" when the box isn't in the collidor, please help!
public GameObject Particula;
void OnTriggerStay (Collider other) {
if (Input.GetMouseButtonDown (0)) {
if (other.gameObject.tag == "box") {
Debug.Log ("win");
Instantiate (Particula, other.transform.position, Quaternion.identity);
Destroy (other.gameObject);
}
}
}
}
19478100-1336416809810043-494402988-n.png
(129.7 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612124907im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity 2D colliders not triggering,Unity 2D collider not triggering 0 Answers
Infinite Collision? Can't figure out bug 0 Answers
How to detect collision of two moving characters? 1 Answer
How to move and rotate to other direction when hitting a wall 1 Answer
How do i get a ball to gain acceleration when hitting an object [Beginner] 1 Answer