How can I add 3 second timer after resuming the game?

Here is the code for a logic manager that manages the game

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class LogicScript : MonoBehaviour
{
    public GameObject pauseMenuScreen;
    
    public static bool isPaused;
     private void Awake()
     {
        pauseMenuScreen.SetActive(false);
        isPaused = false;
        
     }
     void Update()
     {
        if (Input.GetKeyDown(KeyCode.Escape) )
        {
            if (isPaused)
            {
                resumeGame();
            }
            else
            {
                pauseGame();
            }

        }
        public void pauseGame()
        {
          pauseMenuScreen.SetActive(true);
          Time.timeScale = 0f;
          isPaused = true;
         
        }
       public void resumeGame()
       {
        pauseMenuScreen.SetActive(false);

        Time.timeScale = 1f;
         isPaused = false;
        
       }

}

@pmeet862 - you can use the IEnumerator with WaitForSeconds. Modify the resumeGame() function to be a coroutine and use yield return new WaitForSeconds(3f); to wait for 3 seconds before setting the time scale back to 1. Something like this:

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class LogicScript : MonoBehaviour
{
    public GameObject pauseMenuScreen;

    public static bool isPaused;

    private void Awake()
    {
        pauseMenuScreen.SetActive(false);
        isPaused = false;
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (isPaused)
            {
                StartCoroutine(resumeGame());
            }
            else
            {
                pauseGame();
            }
        }
    }

    public void pauseGame()
    {
        pauseMenuScreen.SetActive(true);
        Time.timeScale = 0f;
        isPaused = true;
    }

    public IEnumerator resumeGame()
    {
        pauseMenuScreen.SetActive(false);
        yield return new WaitForSecondsRealtime(3f); // Wait for 3 seconds
        Time.timeScale = 1f;
        isPaused = false;
    }
}

Make sure to add the using System.Collections; namespace at the beginning of the script. Note that I used WaitForSecondsRealtime instead of WaitForSeconds, as WaitForSeconds would be affected by the time scale, whereas WaitForSecondsRealtime is not.