我的场景中有两个脚本。第一个是慢动作脚本。第二个是暂停菜单。在我的暂停菜单脚本中,我是否具有Time.timescale = 0或1,具体取决于它是否已暂停。在慢动作脚本中,我还使用Time.timescale来创建“慢动作”效果。由于某种原因,如果启用了暂停菜单脚本,则无法使用慢动作。如果它被禁用,它就可以正常工作。因此,我得出的结论是问题与Time.timescale有关(我什至对其进行了测试)。这是我的暂停菜单脚本:public bool isPaused; public GameObject canvasPause; MouseLook fpCamMouseLook; MouseOrbitImproved tpCamOrbitLook; // Use this for initialization void Start () { fpCamMouseLook = GameObject.Find ("Main Camera").GetComponent<MouseLook> (); tpCamOrbitLook = GameObject.Find ("ThirdPersonCamera").GetComponent<MouseOrbitImproved> (); } // Update is called once per frame void Update () { if (Input.GetKeyDown (KeyCode.Escape)) { // switch for pause boolean isPaused = !isPaused; } if (isPaused == true) { AudioListener.volume = 0f; canvasPause.SetActive (true); Time.timeScale = 0; fpCamMouseLook.enabled = false; tpCamOrbitLook.enabled = false; } else { AudioListener.volume = 1f; canvasPause.SetActive (false); Time.timeScale = 1; fpCamMouseLook.enabled = true; tpCamOrbitLook.enabled = true; } } // back to menu button public void goBackToMenu(){ Application.LoadLevel ("Menu"); } public void quitToDesktop(){ Application.Quit (); } public void unPause(){ canvasPause.SetActive (false); }这是我的慢动作脚本:float currentAmount = 0f; float maxAmount = 5f; public bool isSlowMo; // Update is called once per frame void Update () { if(Input.GetKeyDown(KeyCode.Tab)){ isSlowMo = !isSlowMo; } if (isSlowMo == true) { if (Time.timeScale == 1.0f) Time.timeScale = 0.3f; } else { Time.timeScale = 1.0f; Time.fixedDeltaTime = 0.02f * Time.timeScale; } if(Time.timeScale == 0.03f){ currentAmount += Time.deltaTime; }请帮忙?
- 1 回答
- 0 关注
- 207 浏览
添加回答
举报
0/150
提交
取消