Unity新手,Debug.Log未显示在控制台上

时间:2018-11-24 15:49:50

标签: c# unity3d

我正在尝试为我的姐妹们创建一个android问答游戏,这第一次很顺利,但是每当我尝试使用此Debug.Log时,它都不会出现在控制台中。我想让问题在游戏运行时出现在控制台中,以测试游戏是否正常运行。我在这里做错什么了吗?

[System.Serializable]
public class Questions {
   public string question;
   public int answer;
}




using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;

public class GameManager : MonoBehaviour
{
    public Questions[] questions; 
    private static List<Questions> unansweredQuestions;

    private Questions currentQuestion;

void start()
{
    if (unansweredQuestions == null || unansweredQuestions.Count == 0)
    {
        unansweredQuestions = questions.ToList<Questions>();   
    }
    GetRandomQuestion();
    Debug.Log(currentQuestion.question + "is" + currentQuestion.answer);
}

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

    unansweredQuestions.RemoveAt(randomQuestionIndex);
}
}

1 个答案:

答案 0 :(得分:1)

您应该使用Start()而不是start()