- Home /
OnTriggerEnter2D not working on sprite's prefab clones
private void OnTriggerEnter2D(Collider2D collision) {
if (collision.gameObject.tag == "Bomb")
{
SceneManager.LoadScene("Game_Over");
}
}
Here is the prefab
$$anonymous$$ore context is needed to answer this question. What are you trying to achieve overall? What's the goal? What's the gameplay? The code your showing is part of what script? What's the expected behaviour and how's that different from what's actually happening?
It should actually load the scene but it won’t The bomb spawns after another gameobject destroys no problem for that but I think something is wrong with my unity engine thanks anyway im going to re-download it. Sorry for this wierd question
It should actually load the scene
Yes, I can see that from code snippet... Tell me what I can't see here. You did not answer the gameplay question. The bomb is supposed to collide with what and then change the scene? You did not answer to what script belongs the posted code. Please man, $$anonymous$$OAR DETAILS. It is not likely that there's something wrong with your Unity installation.
Your answer
Follow this Question
Related Questions
Array of prefabs 0 Answers
Destroying assets is not permitted to avoid data loss? 0 Answers
Cast Source Instantiating Error 1 Answer
How to control variable of prefab and its clone 0 Answers
Unity 2D : How to make a perfect clone of my Game Object? 3 Answers