Unity Scene-重新启动按钮导致进程停止

时间:2018-07-22 03:31:33

标签: c# unity3d

我需要重新启动按钮的帮助..当我重新加载场景时,所有进程都将停止。 //开始

void Start()
{
    if (NoAnsweredQuestion == null || NoAnsweredQuestion.Count == 0)
    {
        NoAnsweredQuestion = question.ToList<Question>();
    }

    SetcurrentQuestion();
    StartCoroutine("CountDownTimer");
}

//设置当前问题

void SetcurrentQuestion()
{
    int randomQuestionIndex = Random.Range(0, NoAnsweredQuestion.Count);
    currentQuestion = NoAnsweredQuestion[randomQuestionIndex];

    factText.text = currentQuestion.fact;
    correctAnswerText.text = currentQuestion.answered;
}

//过渡

IEnumerator TransitiontoNextQuestion()
{
    NoAnsweredQuestion.Remove(currentQuestion);

    yield return new WaitForSeconds(delaybetweenquestion);

    SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}

1 个答案:

答案 0 :(得分:0)

这是我游戏的重启按钮

public void restart()
{
    WWWForm form = new WWWForm();
    WWW www = new WWW(restartBegGrammarIAQ, form);
    Application.LoadLevel(Application.loadedLevel);
}