Help with loading scenes.

I want it to load only one scene but it loads 2 of the same scene “Game Option”. I don’t know the problem. When I press escape, I have to click on resume twice because of it.

My Code

public static bool GameisPaused = false;
public GameObject pauseMenuUI;
// Update is called once per frame
void Update () {
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        if (GameisPaused)
        {
            Resume();
        }
        else
        {
            Pause();

        }
    }
}
public void Resume()
{
    GameisPaused = false;
    SceneManager.UnloadSceneAsync("Game Option");
    Time.timeScale = 1f;
}
void Pause()
{
    GameisPaused = true;
    Time.timeScale = 0f;
    SceneManager.LoadScene("Game Option", LoadSceneMode.Additive);
}

What do you want to do? Are you trying to load a scene when you click “escape” and when you click it again, go back to the first scene?

Do you have “Game Option” scene loaded on the game start? Because it looks like you have two instances of the “Game Option” scene when you pause the game.

If your game starts with “Game Option” scene, then you need to unload it when you load the “Game” scene upon the start.