Im New and had a CS0246 Question.

On the latest version of Unity I seem to be getting an error cs0246 for List and im not sure why can anyone assist me in this?

using UnityEngine;
public class GameController : MonoBehaviour
{
[SerializeField] char _letter = ā€˜a’;
[SerializeField] int _correctAnswers = 5;
private void OnEnable()
{
GenerateBoard();
}
private void GenerateBoard()
{
var letters = FindObjectsOfType();
int count = letters.Length;
List lettersList = new List();
for (int i = 0; i < _correctAnswers; i++)

lettersList.Add(_letter);
for (int i = _correctAnswers; i < count; i++)
{

}
}
private char ChooseInvaldRandomLetter()
{
var chosenLeter = ChooseInvaldRandomLetter();
int a = UnityEngine.Random.Range(0, 26);
var randomLetter = (char)(ā€˜a’ + a);

if (randomLetter == _letter)
return ChooseInvaldRandomLetter();
return randomLetter;

}
}

How to understand compiler and other errors and even fix them yourself:

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: Using code tags properly

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

Thanks ill rework my question better. I appreciate the advice.

1 Like