Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

error CS1061: 'QuestionData' does not contain a definition for 'textoDaPergunta' and no accessible extension method 'textoDaPergunta' accepting a first argument of type 'QuestionData' could be found

$
0
0
**No encuentro el ERROR que podría estar fallando, alguien que me pueda ayudar:** ![alt text][1] using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class GameController : MonoBehaviour{ public Text textoPergunta; public Text textoPontos; public Text textoTimer; public Text highScoreText; public SimpleObjectPool answerButtonObjectPool; public Transform answerButtonParent; public GameObject painelDePerguntas; public GameObject painelFimRodada; private DataController dataController; private RoundData rodadaAtual; private QuestionData [] questionPool; private bool rodadaAtiva; private float tempoRestante; private int questionIndex; private int playerScore; List usedValues = new List(); private List answerButtonGameObjects = new List(); // Start is called before the first frame update void Start() { dataController = FindObjectOfType(); rodadaAtual = dataController.GetCurrentRoundData(); questionPool = rodadaAtual.perguntas; tempoRestante = rodadaAtual.limiteDeTempo; UpdateTimer(); playerScore = 0; questionIndex = 0; ShowQuestion(); rodadaAtiva = true; } // Update is called once per frame void Update() { if (rodadaAtiva) { tempoRestante -= Time.deltaTime; UpdateTimer(); if(tempoRestante <= 0) { EndRound(); } } } private void UpdateTimer() { textoTimer.text = "Timer: " + Mathf.Round(tempoRestante).ToString(); } private void ShowQuestion() { RemoveAnswerButtons(); int random = Random.Range(0, questionPool.Length); while (usedValues.Contains(random)) { random = Random.Range(0, questionPool.Length); } QuestionData questionData = questionPool[random]; usedValues.Add(random); textoPergunta.text = questionData.textoDaPergunta; for (int i = 0; i < questionData.respostas.Length; i++) { GameObject answerButtongameObject = answerButtonObjectPool.GetObject(); answerButtongameObject.transform.SetParent(answerButtonParent); answerButtonGameObjects.Add(answerButtongameObject); AnswerButton answerButton = answerButtongameObject.GetComponent(); answerButton.Setup(questionData.respostas[i]); } } private void RemoveAnswerButtons() { while(answerButtonGameObjects.Count > 0) { answerButtonObjectPool.ReturnObject(answerButtonGameObjects[0]); answerButtonGameObjects.RemoveAt(0); } } public void AnswerButtonClicked(bool estaCorreto) { if (estaCorreto) { playerScore += rodadaAtual.pontosPorAcerto; textoPontos.text = "Score: " + playerScore.ToString(); } if(questionPool.Length > questionIndex + 1) { questionIndex++; ShowQuestion(); } else { EndRound(); } } public void EndRound() { rodadaAtiva = false; painelDePerguntas.SetActive(false); painelFimRodada.SetActive(true); } public void ReturnToMenu() { SceneManager.LoadScene("Menu"); } } [1]: /storage/temp/202272-error-1.jpg

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>