How can I find the name of a Scene?

void DontDestroyPlayer () {

		if (!playerExists) {
			if (currentScene.name = "Battle Screen") {
				Destroy (gameObject);
				return;
			}
			playerExists = true;
			DontDestroyOnLoad (transform.gameObject);
		} 
		else 
		{
			Destroy (gameObject);
		}
	}

Alright, so I’m trying to use an if statement to see if the current scene is the “Battle Screen” scene. The currentScene variable is equal to SceneManager.GetActiveScene().

public Scene currentScene = SceneManager.GetActiveScene();

The way I’m doing it now, it gives me the error CS0272: The property or indexer `UnityEngine.SceneManagement.Scene.name’ cannot be used in this context because the set accessor is inaccessible. I want to know if there’s a way to find out what scene I’m on that won’t give me an error.

Try

If(SceneManager.GetActiveScene().name == “Battle Screen”){
//Your Logic
}