I have a number of arrays which are randomly selected from an array of array names. I have a function that writes the randomly selected array name to a string called newEq. The next function then references this string as the name of an array. But I keep getting the error “Cannot implicitly convert type char' to string’”.
void pickEquation () {
newEq = Eqs[Random.Range(0, 50)];
newEquation();
}
void newEquation () {
LeftText.GetComponent<TextVariable>().Ringvariable = newEq[0];
TopText.GetComponent<TextVariable>().Ringvariable = newEq[1];
RightText.GetComponent<TextVariable>().Ringvariable = newEq[2];
BottomText.GetComponent<TextVariable>().Ringvariable = newEq[3];
Equation.GetComponent<TextVariable>().Ringvariable = newEq[17];
}
newEq is string and so newEq is a char . you should convert char to string or call ToString() function of newEq .
– mujpirDo not use casts here! newEq type is 'string' already.
– StormSabotageLeftText.GetComponent().Ringvariable = Eqs[Random.Range(0, 50)];
– StormSabotagewith or without the "newEq = Eqs[Random.Range(0, 50)];" i have in another void?
– anosmicAnimatornewEq = Eqs[Random.Range(0, 50)]; becomes useless if you write like i said.
– StormSabotage