Here’s the error : Assets/Scripts/DNA.cs(44,35): error CS0021: Cannot apply indexing with to an expression of type `method group’
And here is my code
using UnityEngine;
using System.Collections;
public class DNA
{
//generates random character
char newChar()
{
float c = Mathf.Floor (Random.Range (63, 122));
if (c == 63)
c = 32;
if (c == 64)
c = 46;
return (char)c;
}
//constructer
int num;
public DNA (int numA)
{
num = numA;
}
//genes array of character
char[] genes1;
public char[] genes()
{
float fitness = 0;
for (int i = 0; i < num; i++) {
genes1 *= newChar ();*
-
}*
-
return genes1;*
-
}*
-
//the phrase of the genes array*
-
public string genesPhrase()*
-
{*
-
string Phrase = "";*
-
for (int i2 = 0; i2 < num; i2++)*
-
{*
-
Phrase += genes [i2]; //Here is the error*
-
}*
-
return Phrase;*
-
}*
}
it makes completely no sense, I just use an array like another…
it says that I can’t use [] on a method group. Help!