Hi i am getting this error and unsure how to fix it thanks
Assets\Scripts\Quiz.cs(17,36): error CS1061: ‘QuestionSO’ does not contain a definition for ‘GetAnswer’ and no accessible extension method ‘GetAnswer’ accepting a first argument of type ‘QuestionSO’ could be found (are you missing a using directive or an assembly reference?)
questionSO script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = “Quiz Question”, fileName = “New Question”)]
public class QuestionSO : ScriptableObject
{
[TextArea(2,6)]
[SerializeField] string question = "Enter new question text here";
[SerializeField] string[] answers = new string[4];
[SerializeField] int correctAnswerIndex;
public string GetQuestion()
{
return question;
}
public string GetCorrectAnswer(int index)
{
return answers[index];
}
public int GetAnswerIndex()
{
return correctAnswerIndex;
}
}
Quiz script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class Quiz : MonoBehaviour
{
[SerializeField] TextMeshProUGUI questionText;
[SerializeField] QuestionSO question;
[SerializeField] GameObject[] answerButtons;
void Start()
{
questionText.text = question.GetQuestion();
TextMeshProUGUI buttonText = answerButtons[0].GetComponentInChildren<TextMeshProUGUI>();
buttonText.text = question.GetAnswer(0);
}
}