简体   繁体   中英

Unity can't reload scene properly

I wanna restart the scene , I have a countdown timer in there. I've tried to LoadScene() but the countdown timer is still in the current time before I restart the scene

在此处输入图像描述

在此处输入图像描述

  {
        TheTimer();

        if (stoptimer == true)
        {
            GetComponent<RandomSpawner>().enabled = false;

            textPoin.text = "Total Poin: " + playerObj.GetComponent<Player>().point.ToString();

            playerObj.GetComponent<Player>().enabled = false;
            Destroy(spawnHereObject);
            panelEnd.SetActive(true);
        }
    }

我发现了我的问题,这只是因为在 Update Function 上并使用 Time.time 而不是 Time.realtimeSinceStartup

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM