- Home /
Char class issues
Ey I'm getting a lot of problems trying to use an Array. I got the "object" does not support slicing but I found the answer here: http://forum.unity3d.com/threads/17089-Type-Object-does-not-support-slicing-(error)
But the solution bring me new issues, this time with the char class.
My code: //--------------
class Matrix extends System.Object
{
var xMax : int;
var zMax : int;
var matrixLevel : String;
function Matrix(xM : int, zM : int) {
xMax = xM;
zMax = zM;
matrixLevel = new String[xM+1][zM+1];
}
} //End class Matrix
// ------------------------ I want a matrix of Strings where I plan to store the GameObject.tag for each level of my game. Each level will have a different matrix size.
Problem now is here:
// ------------------------
var AuxStr : String;
AuxStr = scAux.data.matrixLevel[xMatriz+xAux][zMatriz+zAux];
// ------------------------
When I try to pull out the string value to use it in "GameObject.FindWithTag(AuxStr)" later, I can`t do it. I got this time the "char does not support slicing" error.
I realize that this problem only happen with Android/IOS settings, the array build work fine in PC.
How I can I fix this? Is driving my nuts!!
Sorry for my grammar, English is not my mother language. Thanks in advance!
For starters, I recommend explicitly stating the types of all your variables, especially the arrays. See if that helps you. It seems that it is treating the strings like char arrays- (which, they are, but that isn't what you want here). $$anonymous$$ake sure it knows that it's a jagged array of strings, not just a string that you are trying to cut up.
Your answer
![](https://koobas.hobune.stream/wayback/20220613064821im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Errors with my char array 1 Answer
Javascript array questions. 1 Answer
how to create array with grid layout group 1 Answer
How to order RaycastAll by distance on IOS 2 Answers
As I compare 4 objects in an array? 2 Answers