I am getting some weird errors in my scripts. Please spot the error.
Questions script:-
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Question")]
public class Questions : ScriptableObject
{
[TextArea(1, 5)] [SerializeField] string question = "Question????????????";
[TextArea(1, 2)] [SerializeField] string[] answers = new string[4];
[SerializeField] int correctAnswerIndex;
public string GetQuestion()
{
return question;
}
public string GetAnswer(int index)
{
return answers[index];
}
public int GetCorrectAnswerIndex()
{
return correctAnswerIndex;
}
}
Quiz script:-
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class Quiz : MonoBehaviour
{
[SerializeField] TextMeshProUGUI questionText;
[SerializeField] Questions question;
void Start()
{
questionText.text = question.GetQuestion();
}
}
Errors:-