问题描述
实际上,我正在开发的游戏存在问题。单击重新启动按钮不会将分数重新启动为零,我不知道如何解决此问题。因此,我没有使用任何 PlayerPref,而是使用静态分数,scoreText 作为分数文本的名称,ScoringSystem 作为用于增加分数的脚本。
如果可能的话,我需要你的帮助。谢谢!
代码:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class CS_GameOverMenu : MonoBehavIoUr
{
// public GameObject scoreText;
public void RestartButton()
{
score.scoreValue = 0;
// GameObject.Find("scoreText").GetComponent<ScoringSystem>().thescore = 0;
SceneManager.LoadScene("Level 1");
Debug.Log("Game open");
}
public void MenuButton()
{
SceneManager.LoadScene("MainMenu");
Debug.Log("Main Menu open");
}
public void ExitButton()
{
Application.Quit();
Debug.Log("Game closed");
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)