How to load next scene from script

Hello, I currently have not found a way to load my next scene when a Player move to a Trigger Collider. What i tried to do is:

Level.LoadScene(Level.Scenes[1].ID);

But when I tested, the Editor threw exception: “Index out of bound”

Basically, I’m having 2 scenes: “Level 1”, “Level 2”.
So:

  • Is there a standard and neat way to load scenes properly? As far as I know, the method Level.LoadScene() does not contain a string argument.
  • One more thing is that do I need to do some project settings before calling functions that load next scene?

Thanks a lot for the help!

This may help

2 Likes