How do I unpause?

Hello. I’m having trouble unpausing my game. I have a toggle button in the game and I managed to pause the game when I press it. But when I press the resume button it doesn’t unpause and it’s stuck in Time.timeScale = 0;. Please help me. By the way this is a mobile game.

using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections;

public class LevelManager : MonoBehaviour
{
public GameObject pauseMenu;

private void Start()
{
	pauseMenu.SetActive (false);
}

public void TogglePauseMenu()
{
    pauseMenu.SetActive(!pauseMenu.activeSelf);

    if (pauseMenu == false)
    {
        Time.timeScale = 1;
    }

    else
    {
        Time.timeScale = 0;
    }
}

This line:

if (pauseMenu == false)

makes not much sense. “pauseMenu” is a GameObject. You check if the gameobject is false. This is possible but as long as the gameobject exists the check will return true. It will return false when the object is destroyed. You probably wanted to check pauseMenu.activeSelf

if (pauseMenu.activeSelf == false)

UI shouldn’t be affected by Timescale, unless they use the Animator. Check if you’re using one and set the Update mode to, “Unscaled Time.”