繁体   English   中英

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

[英]New to Unity, Debug.Log not showing on console

我正在尝试为我的姐妹们创建一个android Debug.Log游戏,这第一次很顺利,但是每当我尝试使用此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);
}
}

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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