how do i swtich scenes in c#?

Im trying to use a textmesh pro UI button to switch to a scene using C# script. Is there anyone who can help?

Pretty sure TMP has its own subforum, still answering.

  • Make a new script

  • Implement stuff from here: Unity - Scripting API: SceneManagement.SceneManager.LoadScene
    Make sure to have a method that accepts an argument of type string (if you use the name to load the scene) or int (if you use the index)

  • Add the script to your button

  • In the Click event field, add a reference to your script and select the method that changes the scene

  • Fill in the parameter