1
\$\begingroup\$

I keep getting this error:

Assets\Scripts\store.cs(15,26): error CS1503: Argument 1: cannot convert from 'string' to 'char'

When I try this:

public static string[] toArray(string str) {     
        return str.Split(" , ");
}

I know other questions have answered this but they haven't worked. :( Why is this happening and how can I fix it?

Thank you.

\$\endgroup\$
1
\$\begingroup\$

The method require a char not string

public static string[] toArray(string str) {     
        return str.Split(',');
}

Try use code editor recommended by Unity like Visual Studio. It show error right away and how to fix them. enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ Thank you! This basically saved my app! \$\endgroup\$ – Human Friend Jun 23 at 23:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.