LoadLevel not loading another level

Hi, this script can reload the level it’s in but can’t load the next level. Can you help me get it right and on what object should I put it?

void OnTriggerEnter2D(Collider2D other)
    if (other.gameObject.tag == "NextLevel")

You should put it on an object with a 2d collider like a box collider that is a trigger. If this object also moves, it should have a 2d rigidbody. If you are controlling motion yourself, make sure it is kinematíc. Then make sure that there is another 2d collider in the scene which has the tag “NextLevel” on it. Make sure that your collision matrix doesn’t exclude the objects that you expect to get the trigger for.

Your first statement in the statement block other.gameObject.CompareTag("Player"); is redundant as it does absolutely nothing.

You can also debug what’s happening or do poor mans debugging with a simple print("registered trigger collision");and print("loading level"); to see what what is going wrong. Collision detection, or level loading, for instance.

you are trying to compare two different game objects here. I don’t know what you are trying to do here . If you are wanting to go to next level when both “player " and " next level” objects are hitting trigger at the same time then you should use && to check in the same "if " statement.