How to reload a scene using SceneManager

What’s the best approach?

Scene scene = SceneManager.GetActiveScene;
SceneManager.UnloadScene(scene.buildIndex);
SceneManager.SetActiveScene(scene);

or

Scene scene = SceneManager.GetActiveScene;
SceneManager.LoadScene(scene.name);

Scene scene = SceneManager.GetActiveScene();
SceneManager.LoadScene(scene.name);

You forgot the parentheses at the end of GetActiveScene();
It actually works this way! :slight_smile:

One line solutoin

SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);

When I use this method, the scene tries to reload but nothing appears, all my objects in the inspector are grayed out, and I get this

GI output for inputsystem: 9ac3d03a7f7e63ca666b11c91aab98e9 (cc63ffae9ffdd67ae850f7adcd690cea) is missing.

“Error adding system: Data not available.”.

What is happening?

            BoxCollider boxCollider = hit.collider as BoxCollider;
            if (boxCollider != null)
            {
                print("box hit");
                Scene scene = SceneManager.GetActiveScene();
                SceneManager.LoadScene(scene.name);
            }