How to load the current Unity scene? Tried so

SceneManager.LoadScene(SceneManager.GetActiveScene); 

Writes that the group method cannot convert to a string.

In older versions, it seemed to be possible

 Application.LoadScene(EditorApplication.currentScene); 

But this is outdated code. How can I restart the scene from the beginning or just get its number?

1 answer 1

In theory, GetActiveScene is a method. And you refer to it as a property. That is, at a minimum, you need to write like this: SceneManager.GetActiveScene() . It is like an entry-retreat.

Further. The GetActiveScene method returns an object of type Scene which, as can be seen by following the link in the documentation, has a name field that returns the name of the scene.

Accordingly, knowing this, you need to write this:

 SceneManager.LoadScene(SceneManager.GetActiveScene().name);