C# Unity新手,调试日志未显示在控制台上
我正在尝试为我的姐妹们创建一个android问答游戏,这是我第一次玩得很好,但是每当我尝试使用这个C# Unity新手,调试日志未显示在控制台上,c#,unity3d,C#,Unity3d,我正在尝试为我的姐妹们创建一个android问答游戏,这是我第一次玩得很好,但是每当我尝试使用这个Debug.Log时,它都不会出现在控制台上。我希望这些问题在游戏运行时出现在控制台中,以测试它是否正常工作。我做错什么了吗 [System.Serializable] public class Questions { public string question; public int answer; } using System.Collections; using Syst
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);
}
}
[System.Serializable]
公开课问题{
公共字符串问题;
公共回答;
}
使用系统集合;
使用System.Collections.Generic;
使用UnityEngine;
使用System.Linq;
公共类GameManager:MonoBehavior
{
公众问题[]问题;
私有静态列表未回答的问题;
私人问题;
void start()
{
if(unansweredQuestions==null | | unansweredQuestions.Count==0)
{
未回答的问题=问题。ToList();
}
GetRandomQuestion();
Debug.Log(currentQuestion.question+“是”+currentQuestion.answer);
}
void GetRandomQuestion()
{
int randomQuestionIndex=Random.Range(0,未回答的问题.Count);
currentQuestion=未回答的问题[randomQuestionIndex];
未回答的问题。RemoveAt(随机问题索引);
}
}
您应该使用Start()
而不是Start()
函数的正确名称是Start
,而不是Start
。另外,请确保选中了控制台选项卡右上角的info
按钮(带有白色气泡)。哦,谢谢,我还以为整件事本身出了问题