char chsNam;
void SetNam()
{
chsNam[0] = 'T';//NullRefrenceException
}
char chsNam;
void SetNam()
{
chsNam[0] = 'T';//NullRefrenceException
}
@Maynk The thing about arrays is that you need to know their size before you assign to them (unlike lists). You need to set size of your array in one 3 following ways:
(and you can’t add more elements than that size).
char[] array1 = { 'a', 'b', 'c' };
char[] array2 = new char[] { 'a', 'b', 'c' };
char[] array3 = new char[3];
array3[0] = 'a';
array3[1] = 'b';
array3[2] = 'c';
I’m guessing 3rd way is what you want.
You need to define the size of the array before using it. You can see more at Unity documentation.