'Unity CS1001: Identifier expected but all syntax is right?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class QuizManager : MonoBehaviour
{
    public List<QuestionsAndAnswers> QnA;
    public GameObject[] options;
    public int currentQuestion;
    private Text QuestionTxt;


    private void start()
    {
        generateQuestion();
    }

    void SetAnswers()
    {
        for (int i = 0; i < options.Length; i++)
        {
            options[i].transform.GetChild(0).GetComponent<Text>().text = QnA[currentQuestion].Answers.[i];
        }
    }

    void generateQuestion()
    {
        currentQuestion = Random.Range(0, QnA.Count);

        QuestionTxt.text = QnA[currentQuestion].Question;

    }
}

I can't find the problem! I know the problem is in line 23 (options[i].transform.GetChild(0).GetComponent<Text>().text = QnA[currentQuestion].Answers.[i];). It is expecting something but I don't know what. Looking through the web didn't help.



Solution 1:[1]

Cold be the dot at the end of the line? But I don't know the datatype of Answers.

// yours
options[i].transform.GetChild(0).GetComponent<Text>().text = QnA[currentQuestion].Answers.[i];
// new
options[i].transform.GetChild(0).GetComponent<Text>().text = QnA[currentQuestion].Answers[i];

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Raphael