I haven’t used Unity in a few years and am getting error CS0122: ‘QuizUI.SetQuestion(Question)’ is inaccessible due to its protection level.
I’m following a tutorial and as far as I can tell, my code is exactly the same as his. Can anyone help me figure out what I’m doing wrong? 20:41 into this video.
Here’s my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class QuizManager : MonoBehaviour
{
[SerializeField] private QuizUI quizUI;
[SerializeField]
private List<Question> questions;
private Question selectedQuestion;
// Start is called before the first frame update
void Start()
{
SelectQuestion();
}
void SelectQuestion()
{
int val = Random.Range(0, questions.Count);
selectedQuestion = questions[val];
quizUI.SetQuestion(selectedQuestion); //This is the line with the error
}