Hello all,
I have a problem where colliders kicks off before Start() is called and I’m getting a NullReferenceException as the objects aren’t initialized at the time of the collision. The exception is gone when I initialize the objects in Awake().
However, I would still get to the game over scene right after clicking the start button and before any of the objects move and I don’t get any errors in the editor (it’s like the objects are colliding before the game even starts).
I would also like to note that the same code works just fine for other scenes but it gets broken for that specific scene. I’ve tried removing the objects from the scene and building them again but that didn’t help and now I’m not sure what to do
I’m using a very simple collision mechanism:
private void OnTriggerEnter2D(Collider2D collision)
{
SceneManager.LoadScene("Game_Over");
}
Please assist.