private void Update()
    {
        if (currentPairNumber <= 0)
        {
            gameManager.loadWinScene();
        }
        if (Input.GetMouseButtonDown(0) && instance.getGameBegun())
        {
            RaycastHit hit;
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMask.GetMask("CardDeck"))) // added LayerMask  and math.infinity so it works properly
            {
                if (isRotating == false && playerClicks <= 1)
                {
                    print(hit.collider.name);
                    StartCoroutine(RotateCard(hit.collider));

                    playerClicks++;
                    if (playerClicks == 1)
                    {
                        tempTag  = hit.collider.tag;
                        tempCard = hit.collider.gameObject;
                    }
                    if (playerClicks == 2)
                    {
                        if (tempTag == hit.collider.tag)
                        {
                            // tempCard.gameObject.SetActive(false);
                            //hit.collider.gameObject.SetActive(false);
                            gameManager.UpdateTimer(+2);
                            currentPairNumber--;
                            tempCard.GetComponent <Collider>().enabled = false;
                            hit.collider.enabled = false;
                            Destroy(tempCard.gameObject, 2f);
                            Destroy(hit.collider.gameObject, 2f);
                        }
                        else if (playerClicks == 2 && hit.collider.tag != tempTag)
                        {
                            StartCoroutine(RotateCard(tempCard.GetComponent <Collider>()));
                            StartCoroutine(RotateCard(hit.collider));
                        }
                        playerClicks = 0;
                    }
                }
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape) && !isPaused)
        {
            pauseGame();
        }
        else if (Input.GetKeyDown(KeyCode.Escape) && isPaused)
        {
            resumeGame();
        }

        //  if (Input.GetKeyDown(KeyCode.Space))
        //   {
        //     TextManager.Instance.CreateText("+2");
        //    UpdateTimer(+2);
        // }
        if (gateControl.getGameBegun())
        {
            TimerRunning();
        }
    }