簡體   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